So, you think you know JavaScript? (你认为你懂JS吗)

原文是在这里的: http://dmitry.baranovskiy.com/post/91403200

 

Quick test for real understanding of JavaScript core beyond closures and scopes. Here five small scripts. Try to answer what will be alerted in each case without running them in the console. Then you could create a test file and easily check your answers. Ready?

if (!("a" in window)) { var a = 1;}alert(a);
var a = 1, b = function a(x) { x && a(--x); };alert(a);
function a(x) { return x * 2;}var a;alert(a);
function b(x, y, a) { arguments[2] = 10; alert(a);}b(1, 2, 3);
function a() { alert(this);}a.call(null);


posted @   玉米疯收  阅读(2114)  评论(1编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
历史上的今天:
2009-01-26 大年初一,开始CSS
点击右上角即可分享
微信分享提示