# 章序号/节序号/节/笔记序号
codecademy,array
# 概念阐释
# 举例子
# 类比、比较与对比
# 问题
1.
Use an array method to remove the last string of the array `secretMessage`.
Stuck? Get a hint
2.
Great! You can check your work by logging the `.length` of the array.
At this point, the length should be 1 less than the original length.
Stuck? Get a hint
3.
Use an array method to add the words `to` and `Program` as separate strings to the end of the `secretMessage` array.
Stuck? Get a hint
4.
**Change the word `easily` to the word `right` by accessing the index and replacing it.**
*错题*
Stuck? Get a hint
5.
Use an array method to remove the first string of the array.
Stuck? Get a hint
6.
Use an array method to add the string `Programming` to the beginning of the array.
Stuck? Get a hint
7.
Use an array method to remove the strings `get`, `right`, `the`, `first`, `time,`, and replace them with the single string `know,`.
Hint
Call `.splice()` like this:
```
array.splice(indexToStart, numberOfIndices, 'stringToAdd');
```
You can read the documentation on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice).
8.
On one line, use `console.log()` and `.join()` to print the secret message as a sentence.
*用join写成一句话!*
# 问题答案
```js
let secretMessage = ['Learning', 'is', 'not', 'about', 'what', 'you', 'get', 'easily', 'the', 'first', 'time,', 'it', 'is', 'about', 'what', 'you', 'can', 'figure', 'out.', '-2015,', 'Chris', 'Pine,', 'Learn', 'JavaScript'];
// secretMessage.pop();
// console.log(secretMessage);
// console.log(secretMessage.length);
// secretMessage.push('to','program');
// console.log(secretMessage);
// secretMessage[7]='right';
// console.log(secretMessage);
// secretMessage.shift();
// console.log(secretMessage);
// secretMessage.unshift('Programming');
// console.log(secretMessage);
//6,5,'know'
secretMessage.splice(6,5,'know');
console.log(secretMessage);
console.log(secretMessage.join());
```
# 备注(经验集/错误集)
## 经验集
## 错误集
## 参考资料
- https://www.codecademy.com/courses/introduction-to-javascript/projects/secret-message