Comments (7)
试过了,是可以的。
感谢不吝赐教,学习了。
持续关注
from h-blog.
@zaqwsxcderfvtgb 非常感谢阅读和提的 ISSUE,这些对我意义重大!
此问题应该是出自此篇博客: https://github.com/HCThink/h-blog/blob/master/interesting/in1.md
你是在电脑上看的么? 为何 copy 出来在 console 中试一试?
from h-blog.
我在Chrome控制台试的不行
var a = 1; var 1 = a; var 2 = a; var 3 = a;
报错:Uncaught SyntaxError: Unexpected number
from h-blog.
@zaqwsxcderfvtgb 非常感谢阅读和提的 ISSUE,这些对我意义重大!
你得复制上面的代码到 console 中执行, 上述的变量经过特殊处理。
这个问题和 文章中提到的
- amazed 最让我吃惊的方案
var aᅠ = 1;
var a = 2;
var ᅠa = 3;
if(aᅠ ==1 && a == 2 && ᅠa ==3) {
console.log("Why hello there!")
}
原理一样, 其中的三个 a 是不同字符和 a 组合出来的
这里的 var ᅠ1 = a; 中的 ᅠ1 并不是数字,他前面有个别的字符集,渲染不出来。
最简单的方式, 你试着删除这个 1 ᅠ 就会发现要删两次。
from h-blog.
刚才可以打印出来了,也就是说这个a是前后加空格代表的字符集组成的变量,但是现在不报错,只是打印出来的是false,
var a = 1; var ᅠ1 = a; var ᅠ2 = a; var ᅠ3 = a; console.log(aᅠ ==1 && a == 2 && ᅠa ==3)
VM246:4 false
from h-blog.
刚才可以打印出来了,也就是说这个a是前后加空格代表的字符集组成的变量,但是现在不报错,只是打印出来的是false,
var a = 1; var ᅠ1 = a; var ᅠ2 = a; var ᅠ3 = a; console.log(aᅠ ==1 && a == 2 && ᅠa ==3)
VM246:4 false
@zaqwsxcderfvtgb 这是你敲的么 ? 逻辑是不对的, 这种思路下,假设特殊字符是 * ,你的代码应该这么写:
var a = 10;
var *1 = a;
var *2 = a;
var *3 = a;
console.log(a == *1 && a == *2 && a == *3 )
你声明没问题,但是 console.log 中的123是普通的123, 肯定 false 啊
你从原文中复制代码出来 跑一下,是没问题的
var a = 1;
var ᅠ1 = a;
var ᅠ2 = a;
var ᅠ3 = a;
console.log( a ==ᅠ1 && a ==ᅠ2 && a ==ᅠ3 );
from h-blog.
试过了,是可以的。
感谢不吝赐教,学习了。
持续关注
客气了,我还怕表达的不清楚呢,感谢提 issue
from h-blog.
Related Issues (13)
- deno 探索 + 跟进[加急]
- 期望添加 异步 相关的博客 HOT 1
- n p m HOT 2
- 多处显式异常
- koa中间件处理机制与redux中间件处理机制 HOT 1
- Typescript 设计模式
- Leecode 算法题 HOT 1
- 想看些算法相关的东西,最近面试用 HOT 2
- spa相关问题 HOT 2
- 未来规划 HOT 1
- 趣味模块倒数三条内容 404 HOT 1
- 首页改版 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h-blog.