- Makes eval() safer: In non-strict mode, using the eval() function to execute code can be dangerous, as it can execute any code passed to it, including potentially malicious code. In strict mode, using eval() creates a new variable scope, preventing it from accessing variables from the calling scope.
- Disallows duplicate parameter names: In non-strict mode, if you define a function with duplicate parameter names, the last one will override the previous ones. In strict mode, defining a function with duplicate parameter names will result in a SyntaxError.
- Prevents the use of reserved keywords as variable names: In non-strict mode, you can use reserved keywords as variable names without any issues. In strict mode, using a reserved keyword as a variable name will result in a SyntaxError.
- Makes debugging easier: In non-strict mode, certain types of errors can go unnoticed, leading to bugs that are difficult to debug. In strict mode, these errors are caught and thrown as errors, making it easier to find and fix them.