Javascript is not even a true programming language. It is a mess created by Netscape in a week! It is the worst language ever, and yet we run the world wide web on it! There are many modern and wonderful languages that the W3C could approve tomorrow morning as a new web standard... Mobile apps, videogames, video editing… in all those fields people are using SVG. Not mixed with HTML, Javascript and CSS. Just SVG.
The execution context is composed of the activation object (the function's parameters and local variables), a reference to the scope chain, and the value of this. The call stack can be thought of as an array of execution contexts.
The environment in which your code is running is Execution context.
Contents
Variables, scope, environment[edit]
With strict mode, you can not, for example, use undeclared variables.
With ES#6, JavaScript introduced the let keyword and block scope.
Variables defined with var inside a function scope .. don’t leak out of that scope... However, when you define variables with var in a block scope you can totally access them outside that scope... When defining variables with #let, we won’t have this weird out-of-scope access problem... Arrow functions give access to their defining environment while regular functions give access to their calling environment. This access is possible through the special this keyword... this keyword inside a regular function depends on how the function was called... The value of the this keyword inside an arrow function depends on where the function was defined... functions .call, .apply, and .bind can be used to change the calling environment
hoisting — декларации всех используемых переменных переносятся в начало функции
let[edit]
checking variable scope[edit]
functions[edit]
function declaration in a statement always starts with the keyword function. Otherwise it’s a function expression... function declaration in conditionals is allowed in non-strict mode... function name can be inferred. For example, when the anonymous is assigned to a variable... Shorthand method definition can be used in a method declaration on object literals and ES2015 classes... generator function in JavaScript returns a Generator object.. a star character *... function object type has a constructor: Function..The functions created this way don’t have access to the current scope, thus closures cannot be created.
Shorthand and dynamic properties[edit]
const obj = { p1: 10, // Plain old object property (don't abbreviate) f1() {}, // Define a shorthand function property InverseOfPI, // Define a shorthand regular property f2: () => {}, // Define an arrow function property [mystery]: 42, // Define a dynamic property };
JavaScript will first evaluate the expression inside [] and whatever that expression evaluates to becomes the object’s new property. For the example above, the obj object will have a property answer with the value of 42.
Subcategories
This category has the following 4 subcategories, out of 4 total.
J
S
Pages in category "JS"
The following 10 pages are in this category, out of 10 total.