- Go through https://javascript.info/ and JS stuff I might not already know.
- special numeric types infinity,-infinity,NaN
- typeof null as object is a known js bug
- let n = Number("8"); let n = +"8"; let ch = String(8)
- a = b = c = 3; assignemnt operator returns value of assigned variable
- comma operator
let a = (1 + 2, 3 + 4)
alert( a ); // 7 (the result of 3 + 4)
- let age = prompt('How old are you?', 100); //default input value 100
- let isBoss = confirm("Are you the boss?"); // OK or CANCEL
- || operator evaluates from left to rigth and RETURNS first truthy value encountered or the last operand value of false.
let currentUser = null;
let defaultUser = "John";
let name = currentUser || defaultUser || "unnamed";
alert( name ); // selects "John" – the first truthy value
alert( undefined || null || 0 ); // 0 (all falsy, returns the last value)
- & operator evaluates left to right and RETURNS first falsy value or the last operand value if all true.
- The directive continue helps to decrease nesting level
-
In JS object names are references to a memory loacation ie objects are assigned by reference.
let a = { name : "pran" }; let b = a; b.name = "aya"; console.log(a.name)
CLONING
To make a copy of object use
js let newObj = Object.assign(destObj,srcObc1,srcObj2,srcObj3)
will copy the properties of srcObj's to destObj and return the destObj. Eg. to clone an object 'User',let cloneUser = Object.assign({},User)
DEEP CLONING
If source object has properties of type Object eg
let person = { name : "pranaya", address : { street : "a", flat : "b" }}
then the propertystreet
will copied as a reference. To solve this we will need to check if prop of source object is of type Object and then use Object.assign for it. OR uselodash
library function called_.cloneDeep(obj).
-
Garbage collection
- Do first 15 excercies of https://github.com/chris-void/pyway/blob/master/Learn%20Python%20The%20Hard%20Way%2C%203rd%20Edition%20.pdf
- Make changes to SC**T API
- Go through React Native docs