JavaScript: Difference between revisions
Jump to navigation
Jump to search
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Internal= | |||
* [[TypeScript]] | |||
=Subjects= | =Subjects= | ||
* [[JavaScript Concepts|Concepts]] | |||
* [[JavaScript Operations|Operations]] | |||
=Examples= | |||
* [[JavaScript | * [[JavaScript Client to Test CORS|JavaScript Client to Test CORS]] | ||
=Organizatorium= | =Organizatorium= | ||
* The simplest example: https://www.w3schools.com/js/js_whereto.asp | * The simplest example: https://www.w3schools.com/js/js_whereto.asp | ||
=Things I've Found Useful While Working with Chrome Console= | |||
<syntaxhighlight lang='javascript'> | |||
var a = 10; | |||
console.log(a); | |||
var workersUp = function(targetCnt) { | |||
return Cluster.workers().length == targetCnt; | |||
}; | |||
</syntaxhighlight> | |||
A JavaScript identifier must start with lower or upper case letter, underscore (_) or dollar ($). Subsequent characters may include digits. | |||
The Underscore identifier: it is frequently used to preface the name of an object's property or method that is private. | |||
https://underscorejs.org: | |||
<tt>_.range(1, 100000)</tt>: a function to create flexibly numbered lists of integers: https://underscorejs.org/#range | |||
<tt>_.map(list, iteratee, [context])</tt>: https://underscorejs.org/#map | |||
Arrow function expression () =>. The arrow function expression is a syntactically compact alternative to a regular function expression https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions. The basic syntax: | |||
(param1, param2, …, paramN) => { statements } | |||
(param1, param2, …, paramN) => expression | |||
// equivalent with: | |||
=> { return expression; } | |||
When there is one parameter parentheses are optional: | |||
(param) => { statements } | |||
// equivalent with: | |||
param => { statements } |
Latest revision as of 19:39, 15 December 2021
Internal
Subjects
Examples
Organizatorium
- The simplest example: https://www.w3schools.com/js/js_whereto.asp
Things I've Found Useful While Working with Chrome Console
var a = 10;
console.log(a);
var workersUp = function(targetCnt) {
return Cluster.workers().length == targetCnt;
};
A JavaScript identifier must start with lower or upper case letter, underscore (_) or dollar ($). Subsequent characters may include digits.
The Underscore identifier: it is frequently used to preface the name of an object's property or method that is private.
_.range(1, 100000): a function to create flexibly numbered lists of integers: https://underscorejs.org/#range
_.map(list, iteratee, [context]): https://underscorejs.org/#map
Arrow function expression () =>. The arrow function expression is a syntactically compact alternative to a regular function expression https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions. The basic syntax:
(param1, param2, …, paramN) => { statements }
(param1, param2, …, paramN) => expression // equivalent with: => { return expression; }
When there is one parameter parentheses are optional:
(param) => { statements } // equivalent with: param => { statements }