2022-10-04 16:59:10
There is strict mode in JavaScript which makes your code without any bugs and errors
Eliminates some JavaScript silent errors by changing them to throw errors.
Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode.
Prohibits some syntax likely to be defined in future versions of ECMAScript.
Use Strict
To invoke strict mode for an entire script, put the exact statement "use strict"; (or 'use strict';) before any other statements.
For example:
let name="Mirzoyoqub"
1) Strict mode in function: put the exact statement "use strict"; (or 'use strict';) in the function's body before any other statements.
function myStrictFunction() {
// Function-level strict mode syntax
'use strict';
function nested() {
return 'Hello World';
}
return Hi! I'm a strict mode function! ${nested()};
}
2) Strict mode in Classes - all Classes in JavaScript is in Strict mode
82 views미르조야쿱, edited 13:59