Untitled
user_7147158
plain_text
a year ago
1.5 kB
18
Indexable
// todays topic
// 1 - opeartors
// 2 - assignment
// 2 - functions in javascript
// 3 - object in javascript
// true/false = yeh dono ek alag data type hain , means
// Boolean will not equal to string
// console.log(true == "true")
// == not check data type of value
// === value data type also checked
// oprators - * / +
// let a = 10;
// let b =5;
// console.log( a % b)
// assignment operators
// x = y
// x += y x = x+ y
// x -= y x = x -y
// x *= y x = x*y
// objects
// let x = {
// a : "ddsd",
// a:"ddsd",
// 1:"eded",
// b : [1,2,3,4]
// }
// console.log(x.b)
// delete x.a;
// delete x[1];
// console.log(x)
// Array
// const a = [1,2,3,4];
// indexing start from 0
// console.log(a[1])
// functions
// let a = [1,2,3,4];
// let b = [1,2,3,4,5];
// let c = [3,4,5,6]
// simple function
// function hello(aa,bb,cc){
// console.log(this);
// }
// hello(a,b,c)
// arrow function
// const abcd = () => {
// console.log(this)
// }
// abcd()
// difference between arrow function and simple function
let person = {
name: "Ayushi",
age: 20,
greet: function () {
console.log(this.name);
// this here refers to the object
},
};
// console.log(person.greet)
// person.greet();
// in case of arrow function
let person2 = {
name: "Ayushi",
age: 20,
greet: () => {
console.log(this);
// this here refers to the object
},
};
person2.greet();
Editor is loading...
Leave a Comment