Skip to content

Instantly share code, notes, and snippets.

@stepanmas
Last active December 26, 2018 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stepanmas/5d1fe69b602e5f290f3b8338033d03d3 to your computer and use it in GitHub Desktop.
Save stepanmas/5d1fe69b602e5f290f3b8338033d03d3 to your computer and use it in GitHub Desktop.
Собеседование: use strict
'use strict'
x = 5; // error! next examples with let x
console.log(++x); // 6
console.log(x++); // 6
function foo() {
console.log(x); // undefined, because there is x below
x += 5;
console.log(x); // NaN
var x = 2;
console.log(x); // 2
}
foo();
console.log(x); // 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment