This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onerror = function(message, file, line, column, error) { | |
error = error || {}; | |
$.ajax({ | |
method: 'POST', | |
url: 'https://yourapp.com/path/to/error/log', | |
data: JSON.stringify({ | |
message: message, | |
file: file, | |
line: line, | |
column: column, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var a = b = 5; | |
})(); | |
console.log(b); | |
// 1. What will be printed on the console? | |
// 2. Rewrite the code to return the same result but with the variable declarations separated | |
// 3. Enable strict mode to explicitly reference the scope |