question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"use strict" converted to hexa breaks strict mode

See original GitHub issue

Maybe an “exclude” option could be useful for string to hexa. Additionally, strings are always converted to hexadecimal code. Since it’s not difficult to decrypt hexa, could you please make this optional ?

function is_strict(){
    'use strict'; // <------- broken
    var is_strict = false;
    try {
        mistypeVariable = 17;  // throws a ReferenceError in strict mode
    } catch(e) {
        is_strict = true;
    }
    return is_strict;
}
alert('strict mode = '+is_strict());

//function is_strict() {
//    '\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74';
//    var _0x2d65e3 = ![];
//    try {
//        mistypeVariable = 0x11;
//    } catch (_0x457d9d) {
//        _0x2d65e3 = !![];
//    }
//    return _0x2d65e3;
//}
//alert('\x73\x74\x72\x69\x63\x74\x20\x6d\x6f\x64\x65\x20\x3d\x20' + is_strict());
    

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

8reactions
sp-kilobugcommented, Jul 23, 2017

Thank you very much, it’s perfect

0reactions
sanex3339commented, Jul 23, 2017

Nice. Please close the issue if your problem was solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >
Changed octals to hex for ES6 strict mode #2866 - GitHub
I think this issue and #2835 cover the same problem – is anyone else seeing ES6-style stuff (e.g. babel) break without this?
Read more >
Why are Octal numeric literals not allowed in strict mode (and ...
Octal literals are not allowed because disallowing them discourages programmers from using leading zeros as padding in a script.
Read more >
JavaScript Strict Mode
Nothing. The “use strict” directive is simply a string statement that will be ignored by JavaScript engines that don't support Strict Mode. This ......
Read more >
JavaScript: Convert ASCII to Hexadecimal format - w3resource
DEC OCT HEX BIN Symbol HTML Number Description 0 000 00 00000000 NUL &#000 Null char 1 001 01 00000001 SOH &#001 Start of Heading 2...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found