[[][[]]+[]][+[]][++[+[]][+[]]] is "n" in javascript
来源:互联网 发布:红蜘蛛软件年费 编辑:程序博客网 时间:2024/06/15 19:51
[[][[]]+[]][+[]][++[+[]][+[]]]
This evaluates to "n" in javascript. Why?
Let's start with an empty array
[]
Now, let's access a member of it.
[][]
What member? Let's check for the empty array member
[][[]]
oh, that is undefined. But if we add an empty array to that, it is casted to the string "undefined"
[][[]]+[]
Let us wrap that in an array
[[][[]]+[]]
We can now try to access letters in that string. First, we must unwrap the string. That can be done by accessing the first element of that array.
[[][[]]+[]][0]
0 can be created by casting an empty array to a number:
[[][[]]+[]][+[]]
Now, "n" is the second letter in that string, so we would like to access that:
[[][[]]+[]][+[]][1]
But how can we write 1? Well, we increment 0, of course. Wrap 0 in an array, and increment the first member of it:
++[0][0]
Like before, this is equivalent to
++[+[]][+[]]
So our final code is then the glorious
[[][[]]+[]][+[]][++[+[]][+[]]]
[[][[]]+[]] [+[]][++[+[]] [+[]]]这在javascript中评估为“n”。 为什么?我们从一个空数组开始[]现在,让我们访问它的成员。[] []什么成员? 我们来检查一下空的数组成员[] [[]]哦,这是未定义的。 但是,如果我们添加一个空数组,它被转换为字符串“undefined”[] [[]] + []让我们把它包装在一个数组中[[][[]]+[]]我们现在可以尝试访问该字符串中的字母。 首先,我们必须打开字符串。 这可以通过访问该数组的第一个元素来完成。[[][[]]+[]] [0]可以通过将一个空数组转换为数字来创建0:[[][[]]+[]] [+[]]现在,“n”是该字符串中的第二个字母,因此我们想访问:[[][[]]+[]] [+[]] [1]但是我们怎么能写1? 那么当然我们增加0。 在数组中包装0,并增加其中的第一个成员:++[0] [0]像以前一样,这相当于++[+[]] [+[]]那么我们的最终代码就是光荣的[[][[]]+[]] [+[]][++[+[]] [+[]]]
- [[][[]]+[]][+[]][++[+[]][+[]]] is "n" in javascript
- What is apply() method in JavaScript
- What is Bind method in JavaScript
- There is no function equals() in JavaScript!!!
- In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.
- What is the Execution Context & Stack in JavaScript? [转载]
- What is the !! (not not) operator in JavaScript?
- Truthy and Falsy: When All is Not Equal in JavaScript
- Part 90 - Remote validation in mvc when javascript is disabled
- SpiderMonkey is Mozilla's JavaScript engine written in C/C++
- ------javascript------N
- Caused by: java.rmi.server.ExportException: Port already in use: 1098; nested exception is: java.n
- gvim中Mapping already in use: "<LocalLeader>is", mode "n"错误解决
- gvim中Mapping already in use: "<LocalLeader>is", mode "n"错误解决
- gvim中Mapping already in use: "<LocalLeader>is", mode "n"错误解决
- Solution to Maximum Subarray in linear-time algorithm with time complexity is O(n)
- What is new in Android security (M and N Version) - Google I/O 2016 翻译
- IE Compatibility() Chart Id is same as a JavaScript variable name. Variable n
- Docker 中 安装Linux镜像
- 折半查找
- c#代码规范
- 【Leetcode】33. Search in Rotated Sorted Array
- HashMap+ConcurrentHashMap+HashTable
- [[][[]]+[]][+[]][++[+[]][+[]]] is "n" in javascript
- 如何使用Burp Suite Macros绕过防护进行自动化fuzz测试
- Oracle 创建表的存储过程
- Android中的WIFI模块开发思路
- Python时间序列LSTM预测系列教程(3)-单变量
- : java.net.SocketTimeoutException: connect timed out
- PowerDesigner逆向工程导入MYSQL数据库总结
- oh-my-zsh 强大漂亮的shell命令
- flex布局