Skip to content

[Bug]: Missing Implementation of String.prototype.replaceAll Method #7013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ayuan0828 opened this issue Feb 27, 2025 · 4 comments
Open

[Bug]: Missing Implementation of String.prototype.replaceAll Method #7013

ayuan0828 opened this issue Feb 27, 2025 · 4 comments
Labels

Comments

@ayuan0828
Copy link

ChakraCore Version

36becec

Steps to reproduce

When executing code containing the String.prototype.replaceAll method, a TypeError: Object doesn't support property or method 'replaceAll' occurs.

Proof of concept

var replaceWith = function (inputStr) {
    return inputStr.replaceAll('a', 'b');
};
var originalStr = 'Y)a,K;aC&.';
var modifiedStr = replaceWith(originalStr);
print(modifiedStr);

Exception or Error

TypeError: Object doesn't support property or method 'replaceAll'
   at replaceWith (/home/test.js:2:5)
   at Global code (/home/test.js:5:1)

Additional Context

No response

@ayuan0828 ayuan0828 added the Bug label Feb 27, 2025
@Owaiseimdad
Copy link

@ayuan0828 , works perfectly fine when I use the same code in console. Please attach a screenshot on when you are facing the issues.

Image

@ayuan0828
Copy link
Author

Image
Here's a screenshot of my execution, and I'm very confused.

@Owaiseimdad
Copy link

@ayuan0828 then its might be that originalStr is not a string but an object which is getting sent.

@ayuan0828
Copy link
Author

The function "matchAll" is the same case, maybe for the same reason?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants