-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray7.html
More file actions
26 lines (22 loc) · 789 Bytes
/
Array7.html
File metadata and controls
26 lines (22 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<h3> demo on for spread operator(...)(ECMA script)</h3>
<script>
const x=[21,22,33];
let y=[...x]; // array copied
//y=x; it is copying ref
document.write(`X : ${x}<br>`);
document.write(`Y : ${y}<br>`);
const ft=['html','css','js','bs'];
const bt=['servlet','asp.net','php'];
const db=['oracle','sql-server'];
const fs=[...ft,...bt,...db];//array merge
document.write(`FS : ${fs}<br>`);
const a=[...ft,'react',...bt];
document.write(`A : ${a}<br>`);
</script>
<!-- >"..." is unary operator,we should use this operator as prefix.
>Its spread operator.
>the spread operator represents all remaining values/so on values.
>this we can use in methods and arrays.
Syn: ...array <-spread
...collection <-spread
-->