Created
September 20, 2021 15:22
-
-
Save anisur3036/82b282d57f6063f531154fd178849a83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> | |
.blue { | |
color: white; | |
background-color: rgb(255, 145, 0); | |
} | |
</style> | |
</head> | |
<body> | |
<button class="btn">click me</button> | |
<script> | |
const btn = document.querySelector('.btn'); | |
// console.log(btns); | |
btn.addEventListener('click', function () { | |
this.classList.toggle('blue'); | |
}) | |
// let day = 'susnday'; | |
// switch (day) { | |
// case 'saturday': | |
// console.log('Today is Saturday'); | |
// break; | |
// case 'sunday': | |
// console.log('Today is Sunday'); | |
// break; | |
// } | |
// for loop | |
let fruits = ['Apple', 'Banana', 'Orange', 'Jackfruit', 'Mango']; | |
// console.table(fruits); | |
for (let i = 0; i < 5; i++) { | |
console.table(fruits[i]) | |
} | |
let k = 0; | |
while (k < 5) { | |
console.log('EEEE' + k) | |
k++; | |
} | |
fruits.forEach(function (item) { | |
console.log(item); | |
}) | |
fruits.forEach((item) => { | |
console.log(item); | |
}); | |
//nameless function | |
var bike = 'Hero Hunda outside'; | |
// self execution function | |
(function () { | |
var bike = 'Hero Hunda inside'; | |
// console.log(bike); | |
window.bike = bike; | |
})(); | |
console.log(bike); | |
const myname1 = function () { | |
return 1; | |
} | |
//nameless function | |
const myname = function (n1) { | |
return function (n2) { | |
return function (n3) { | |
return n1 + n2 + n3 | |
} | |
} | |
} | |
//arrow function / fat arrow function | |
const myname11 = (n1) => (n2) => (n3) => n1 + n2 + n3; | |
console.log(myname11(2)(2)(3)); | |
console.log('..........................'); | |
console.log(window); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment