Yet another free online book that I'm tho it is worth buying.
Object.freeze does exactly that except it is shallow
ToObject
throws errors upon encountering null and undefined
0.1 + 0.2 !== 0.3 floating point numbers can't be represented accurately. Although numbers close to 0 can be stored more accurately
Accurate Math Functions. Math.expm1
Math.log1p
Used for asm.js Math.fround
Math.imul
Bitwise operations Math.clz32(0b0000001)
You can represent bytes/hex/octal by adding 0b
0x
0o
respectively to the beginning of a string
To avoid versioning -- that thing that happened with python -- javascript made itself backwards compatible. Which proved to be difficult since old code could break upon changing. So they added "strict mode" which gives you all the new errors and enhancements to the language. This is enabled by default in classes and in modern web frameworks, you can however enable it in a single function only by adding "use strict"
.
There is the capability of making factories
or lazy generators
in JavaScript
Iterators with Symbol.Iterator
You can extend an Error class in javascript.
There are maps in javascript
BigInt in javascript
Static method to Number. IsSafeInteger
Number.MAX_SAFE_INTEGER
Number.parseInt
Number.parseFloat
Number.isNAN
Number.EPSILON
Number.isInteger
Number.isFinite
why const prevents the weird closure bug
const creates one binding per iteration, var creates one binding per loop. That is why const solves the closure bug.
https://exploringjs.com/es6/ch_variables.html#sec_rationale-per-iteration-bindings
https://exploringjs.com/es6/ch_variables.html#sec_rationale-per-iteration-bindings
Cool websites about Javascript
Top comments (1)
If anyone has anything quirky or useful about JavaScript, I am all ears. This will be my repo for knowledge about JavaScript in the future.
On a side note, apparently you can know make web components natively, since when did this happen?