Skip to content

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

Open
@DavidTore

Description

@DavidTore

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions