Skip to main content

Advanced JS Notes

 Advanced JS Notes :




Arrow Functions: 

Code: 
let sumIs = (a, b) => a + b

console.log(sumIs);

let randomIs = () => Math.random;

document.addEventListener('click', () => console.log("click");)


Spread Operator


// Spread Operator

arr = [1, 3, 1];

let sum = (a, b) => a + b;

let s = sum(...arr);
// console.log(s);

arr2 = [2, 5, 5];
let b = [...arr, ...arr2]; //Concating arr using spread
console.log(b);

// Spread With Obj

let obj1 = {
  name: "Mihir",
  age: 24,
  favStar: "TrishCollins",
};


let obj2 = { ...obj1, name: "Rahul", favStar: "SRK" };
// Object manipulation using spread operator

console.log(obj2);

Comments

Popular posts from this blog

React Native Full Notes

React Native Full Notes Device Orientation Like Youtube - First Go To App.json and set orientation:: "default"; Then go to project folder and run npm i @react-native-community/hooks import  {  }  from   'expo-status-bar' ; import   React   from   'react' ; import  {  Dimensions ,  StyleSheet ,  SafeAreaView ,  Text ,  View ,  Button ,  Platform ,  StatusBar  }  from   'react-native' ; import  {  useDimensions ,  useDeviceOrientation  }  from   "@react-native-community/hooks" ;   export   default   function   App () {    const  {  landscape  } =  useDeviceOrientation ();    return  (      < SafeAreaView   style = { styles . container } >        < View   style = { {          backg...

Linux Basics Cmd

  Install Package      sudo apt update     sudo apt install discord (Error_?)     sudo apt --fix-broken install  Remove Packages:     sudo apt remove firefox-esr (remove without deleting user data)     sudo apt purge firefox-esr (remove all user data) Update & upgrade :     sudo apt update && sudo apt upgrade     dpkg -l (List insatllled packages)