Aha..!! That's JavaScript
kind of mixed feelings, I'll post - JavaScript, TypeScript, vue.js, react, angular.
This might help in Interviews as well.
TYPE of
typeof null // "object" (not "null" for legacy reasons)
typeof undefined // "undefined"
null === undefined // false
null == undefined // true
null === null // true
null == null // true
!null // true
isNaN(1 + null) // false
isNaN(1 + undefined) // true
typeof(NaN) // number
FAT Arrow function - ES6
Syntax difference
// Regular Function Syntax ES5:var add = function(x, y) { return x + y;};// Arrow function ES6let add = (x, y) => { return x + y };
Arguments binding
// Object with Regular function.
let getData = {
// Regular function
showArg:function(){
console.log(arguments);
}
}
getData.showArg(1,2,3); // output {0:1,1:2,2:3}
------------------------------------------------------------------
// Object with Arrow function.
let getData = {
// Arrow function
showArg:()=>console.log(arguments)
}
getData.showArg(1,2,3); // Uncaught ReferenceError: arguments is not defined
Use of this keyword
let name ={ | |
fullName:'Vandna Kapoor', | |
printInRegular: function(){ | |
console.log(`My Name is ${this.fullName}`); | |
}, | |
printInArrow:()=>console.log(`My Name is ${this.fullName}`) | |
} | |
name.printInRegular(); | |
name.printInArrow(); |
Using a new keyword
let add = (x, y) => console.log(x + y);
new add(2,3);
No duplicate named parameters
Arrow functions can never have duplicate named parameters, whether in strict or non-strict mode.
However, We can use duplicate named parameters for regular function in non-strict mode.
found this on YouTube: link ref below
1. Use TS + tRPC to ensure you have type safety.
2. Use AbortSignal to invalidate previous requests when a new character is input.
tRPC - Move Fast and Break Nothing. End-to-end typesafe APIs made easy. | tRPC
AbortSignal - Web APIs | MDN (mozilla.org)
avoid debouncing: it's a programming pattern or a technique to restrict the calling of a time-consuming function frequently, by delaying the execution of the function until a specified time to avoid unnecessary CPU cycles and API calls and improve performance.
It's a higher-order function that returns another function, to create closure around the function params (foo, timeout) and the timer intervals.
CSS stuffs too:
LESS SASS SCSS MIXINS --- source geeksforgeeks
LESS stands for Leaner Style Sheets. It is a backward-compatible language extension for CSS. It allows us to use features like variables, nesting, mixins, etc, all in a CSS-compatible syntax. LESS is influenced by SASS and has influenced the newer “SCSS” syntax of SASS. LESS was used in Bootstrap 3 but was replaced by SASS in Bootstrap 4.
File Type: All LESS files must have the .less file extension.
Working: A web browser does not understand the LESS code itself. That is why you will require a LESS pre-processor to change LESS codes into simple standard CSS code.
Working Steps:
- Write the LESS code in a file.
- Compile the LESS code into CSS code using the command lessc style.less style.css.
- Include the compiled CSS file in the html file.
Features:
- Variables: Variables can be used to store CSS values that may be reused. They are initialized with @.
Comments
Post a Comment