Recently, working with JavaScript in Developer Tool, I found strange feature. Chrome accepts any code between opening bracket with operator (plus, minus sign) and operator with closing brackets and executes it, like this:
I didn't find this behaviour in another browsers, just in Chrome.
Maybe it's a feature, but why and how it works, can it be problem with JavaScript engine?
Use the Chrome DevTools Sources panel to: View files. Edit CSS and JavaScript. Create and save Snippets of JavaScript, which you can run on any page.
Open Chrome DevTools. Press Control+Shift+P or Command+Shift+P (Mac) to open the Command Menu. Start typing javascript , select Disable JavaScript, and then press Enter to run the command. JavaScript is now disabled.
This is the way chrome evaluates your input:
with (typeof __commandLineAPI !== 'undefined' ? __commandLineAPI : { __proto__: null }) {
// your code here...
}
So once your input is }{
it becomes
with (typeof __commandLineAPI !== 'undefined' ? __commandLineAPI : { __proto__: null }) {}{} // indefined
Next input }-+{
becomes
undefined -+ {} // NaN
And so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With