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 27 28 29
| <script type="text/javascript"> let arr1 = [1, 3, 5, 7, 9] let arr2 = [2, 4, 6, 8, 10] let arr3 = [...arr1, ...arr2]
function sum(...numbers) { return numbers.reduce((preValue, currentValue) => { return preValue + currentValue }) }
var person = { name: 'tom', age: 18, add: { city: 'beijing', price: { num: 123 } } } let person2 = { ...person } person.name = 'jerry' person.add.city = 'shanghai' person.add.price.num = 456 console.log(person); console.log(person2); let person3 = { ...person, name: 'jack', address: "地球" }
</script>
|