Tell us what’s happening:
Describe your issue in detail here.
Your code so far
Как понять это задание?
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
// Only change code below this line
const arr = list; // Change this line
// Only change code above this line
return arr;
}
const arr = removeFirstTwo(source);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.124 YaBrowser/22.9.4.863 Yowser/2.5 Safari/537.36
Challenge: ES6 - Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements
Я не понимаю вопроса, и не понимаю теперь ответов почему в const source = [1,2,3,4,5,6,7,8,9,10]; надо писать const{a,b, …arr}= list; а не const{a,b, …arr}= source;?
When you don’t understand the question, you should ask questions about it. You should not copy the answer.
You should not reference a global variable when you have a function argument. If you use source, then your function only works for that one array instead of any array list
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
// Only change code below this line
const{a,b, ...arr}= list;
const arr = list; // Chan ge this line
// Only change code above this line
return arr;
}
const arr = removeFirstTwo(source);
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
// Only change code below this line
const[a, b, ...arr]= list;
// Chan ge this line
// Only change code above this line
const arr = list;
return arr;
}
const arr = removeFirstTwo(source);
console.log(arr);
console.log(source);
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Но я не понимаю как изменить строку const arr = list;я думаю она уже изменена,по этому я и не понимаю вопроса,в задание сказано опустить две переменные,а тут целая головоломка не чего понять не возможно.
да я сбросил код,и написал одну строчку кода но не чего не работает
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
// Only change code below this line
const[a,b, ...arr] = list;
const arr = list; // Change this line
// Only change code above this line
return arr;
}
const arr = removeFirstTwo(source);
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
// Only change code below this line
//...
const[a,b, ...arr] = list;
//...
// Change this line
// Only change code above this line
return arr;
}
const arr = removeFirstTwo(source);