8000 spread operator and other programs · anshi-the-coder/Javascript@20c042c · GitHub
[go: up one dir, main page]

Skip to content

Commit 20c042c

Browse files
spread operator and other programs
1 parent c2fbaa8 commit 20c042c

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

PracticeSet/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<link rel="stylesheet" href="style.css" type="text/css" />
8+
</head>
9+
<body>
10+
<script src="script.js"></script>
11+
</body>
12+
</html>

PracticeSet/script.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const loadScript = (src)=>{
2+
return new Promise((resolve, reject)=>{
3+
let script = document.createElement("script")
4+
script.src= src
5+
script.onload = ()=>{
6+
resolve(src)
7+
}
8+
})
9+
}
10+
let a = loadScript("https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.css")

PracticeSet/style.css

Whitespace-only changes.

mapFilterReduce.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
let arr3 = [1,2,3,5,2,1]
1717
//let newarr3= arr3.reduce((h1,h2)=>{
1818
const reduce_fun = (h1,h2)=>{
19-
return h1+h2
20-
}
19+
return h1+h2
20+
}
2121
let newarr3 = arr3.reduce(reduce_fun)
2222
console.log(newarr3)
2323

spreadOperator.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let arr=[1,2,3]
2+
let arr2=[4,5,6]
3+
let arr3=[...arr,12,43,112,56]
4+
console.log(arr3.length)
5+
6+
let obj={a:1,b:2,c:3}
7+
let person={name:"Rohit",age:24}
8+
let mergedObj={...obj,...person}
9+
console.log(mergedObj)

0 commit comments

Comments
 (0)
0