https://jex.im/regulex/#!embed=false&flags=&re=%5E(a%7Cb)*%3F%24
V8 performance rival that of JVM and CLR. Let that sink in a bit.
If you're creating constructor functions and inheriting from them, you haven't learned JavaScript. You're failing to take advantage of JavaScript's most powerful capabilities: Prototypal Inheritance.
JavaScript dynamic duo (static type is overrated):
- Captain Obvious on JavaScript
- 1 JS Tips Everyday
- 10 Most Recommended JS articles of 2015
- A special issue looking back at the best of 2015
- Documentation
- JSFeeds
- Want to learn JavaScript in 2015?
- Essential JavaScript Links
- Original Essential JavaScript Links
- JavaScript application architecture in 2015
- ES6 Learning
- Data structures for JS
- ES Discuss
- Loose typing
- Object extension
- globtester
- FPS engine
- JSNice - deobfuscation
- A JavaScript Quality Guide
- Regular expression in JavaScript
- Mixins, Forwarding, and Delegation in JavaScript
- Variable hoisting
- JavaScript for OSX Automation
- 5 array methods you should use today
- Code optimization
- Drag and Drop interaction ideas
- Flow - static type checker
- Flow - Static type checker
- Functional JavaScript
- Scoop JS resources
- The Jackal of JavaScript
- Avoid forEach
- 7 essential JavaScript functions
- Signup autocompletion with Gravatar
- Global eval. What are the options?
console.log( '%c %s %s %s ', 'color: yellow; background-color: black;', ' — ', 'hello', ' — ');
console.trace('debug')Objects are merely a poor man's closures.
Closures are a poor man's object.
Closures are the key to encapsulation in JavaScript. They enable true data privacy for objects, and protect against function side effects.
Having a poor understanding of how closures work can cause tight coupling and side-effects when they're misused, which quickly leads to unmaintainable code and a breeding ground for bugs.
Closures minimize shared state and side-effects.
- Optimization killers
- Is JavaScript guaranteed to be single-threaded?
- The JavaScript Event Loop
- The JavaScript Event Loop Explained
- What is JavaScript Event Loop?
- Video: What the heck is the event loop anyway?
JavaScript engine. JavaScript queue. Actual OS events.
- Ariya Hidayat
- Axel Rauschmayer
- Kyle Simpson
- Rob Richardson
- Hugo Giraudel
- Sam Dutton
- Volkan
- Mike Engel
- Felix Kling
- Justin Fagnani
- kangax
macro foo {
rule { $x plus $y } => {
$x + $y
}
}
foo 5 plus 6 // -> 5 + 6
// ES6 Fat arrow
macro => {
rule infix { ($value (,) ...) | ($body ...) } => {
function($value (,) ...) {
$body ...
}.bind(this)
}
rule infix { ($value (,) ...) | $guard:expr } => {
function($value (,) ...) {
return $guard;
}.bind(this)
}
rule infix { $param:ident | $guard:expr } => {
function($param) {
return $guard;
}.bind(this)
}
}
// To use it
(x, y, z) => {
return x * y * z;
}
Use cases:
- Templating
- Routing
- I18n
- Date and currency formatting
- Model validation
- API interaction
Magic happens in the build process: Browserify and Grunt.
4 equality algorithms in ES6:
- Abstract Equality Comparison
== - Strict Equality Comparison
===. Used in case statement,Array.prototype.indexOf,Array.prototype.lastIndexOf - SameValueZero.
ArrayBufferas well asMapandSet. Also when doing[NaN].includes(NaN) - SameValue - Used in all other places
Problem with surrogate pair like "pile of poo" U+1F4A9
function getSurrogates(codePoint) {
var high = Math.floor((codePoint - 0x10000) / 0x400) + 0xD800;
var low = (codePoint - 0x10000) % 0x400 + 0xDC00;
return [high, low];
}
function getCodePoint(high, low) {
var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
return codePoint;
}
// ES6
Array.from(string).length;
function countSymbolsPedantically(string) {
// Unicode Normalization, NRC form:
var normalized = string.normalize('NFC');
// Account for astral symbols / surrogates:
return Array.from(normalized).length;
}