FreeCodeCampChina / freecodecamp.cn

FCC China open source codebase and curriculum. Learn to code and help nonprofits.

Home Page:https://fcc.asia/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Code I write wrong deliberately can run and work as well.

DavidTore opened this issue · comments

Challenge Manipulate Arrays With pop has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

// 举例
var ourArray = [1,2,3];
var removedFromOurArray = ourArray.pop(); 
// 经过 pop 操作之后,removedFromOurArray 的值为 3, ourArray 的值为 [1,2]

// 初始化变量
var myArray = [["John", 23], ["cat", 2]];

// 请只修改这条注释以下的代码
var removedFromMyArray = myArray[myArray.length - 1];

When I run the code mentioned above, I surprisedly found that it can work as well ! That is WRONG, because myArray still has a second array. I deliberately remain the second children.

And when I switch to the FCC English Version, my code CANNOT PASS the test.