Skip to content

Commit 9887aad

Browse files
spread and rest
1 parent 5154916 commit 9887aad

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

SpreadAndrest/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
let nums = [1, 2, 3, 4, 5];
2+
let updatednums = [...nums];
3+
updatednums.push(6);
4+
5+
console.log(nums);
6+
console.log(updatednums);
7+
8+
function one(a, b, ...c) {
9+
console.log(a, b);
10+
console.log(...c);
11+
}
12+
one(3, 4, 9, 0, 1);
13+
14+
let student = {
15+
name: "ravi",
16+
gender: "male",
17+
};
18+
19+
let updateStudent = { ...student, age: 21 };
20+
21+
console.log(updateStudent);

SpreadAndrest/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
7+
<title>Spread and Rest</title>
8+
</head>
9+
<body>
10+
<center>
11+
<h1>Spread and Rest</h1>
12+
</center>
13+
14+
<div id="container"></div>
15+
16+
<script src="./app.js"></script>
17+
</body>
18+
</html>

0 commit comments

Comments
 (0)