[text] we progs

Viewer

copydownloadembedprintName: we progs
  1. //Arrow function
  2. const add = (a, b) => a + b;
  3.  
  4. console.log("the sum of two numbers is " + add(1, 20));
  5.  
  6. //object
  7.  
  8. const obj = {};
  9. obj.name = "john";
  10. obj.age = 20;
  11.  
  12. console.log("The name is " + obj.name);
  13. console.log("The age is " + obj.age);
  14.  
  15. //Destructuring
  16.  
  17. const person = {
  18.     pname: "John",
  19.     pAge: 20,
  20.     address: {
  21.         city: "hyderabad",
  22.         pin: 500047,
  23.  
  24.     },
  25. };
  26. const { pname, pAge, address: { city, pin } } = person;
  27. console.log("The name is " + pname + " and age is " + pAge);
  28. console.log("The address is " + city + " . pincode " + pin);

Editor

You can edit this paste and save as new:


File Description
  • we progs
  • Paste Code
  • 22 Feb-2024
  • 588 Bytes
You can Share it: