Skip to content

Commit

Permalink
Merge pull request #22 from xingorg1/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
xingorg1 authored Jul 5, 2021
2 parents 9467628 + 821c965 commit bdef7db
Show file tree
Hide file tree
Showing 19 changed files with 6,188 additions and 109 deletions.
7 changes: 7 additions & 0 deletions ProfessionalJavaScriptForWebDevelopers/06/02/concat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let array1 = [1]
console.log(array1.concat(2)); // [ 1, 2 ]
console.log(array1.concat(3,4, [5])); // [ 1, 3, 4, 5 ]
console.log(array1.concat([6, 7])); // [ 1, 6, 7 ]
console.log(array1.concat([8], [9, 10])); // [ 1, 8, 9, 10 ]

console.log(array1.concat(2).concat(3,4,[5]).concat([6, 7]).concat([8], [9, 10])) // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
20 changes: 20 additions & 0 deletions ProfessionalJavaScriptForWebDevelopers/06/02/valueof.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!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>6.2.7 转换方法-valueOf</title>
</head>
<body>
<script>
Array.prototype.valueOf = function () {
return this.map((item) => {
return item + '石头姐'
})
}
let array1 = [1, 2]
console.log(array1.valueOf())
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions ProfessionalJavaScriptForWebDevelopers/06/02/valueof.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let array1 = [1, 2]
console.log(array1.valueOf()) // [1, 2]
Array.prototype.valueOf = function () {
return this.map((item) => {
return item + '石头姐'
})
}
console.log(array1.valueOf()) // [ '1石头姐', '2石头姐' ]

Loading

0 comments on commit bdef7db

Please sign in to comment.