网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
01月22日漏签0天
javascript吧 关注:269,157贴子:906,502
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 首页 上一页 1 2
  • 16回复贴,共2页
  • ,跳到 页  
<<返回javascript吧
>0< 加载中...

回复:{}+'a'的值到底是什么?

  • 只看楼主
  • 收藏

  • 回复
  • gainover
  • Error
    10
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
查了下。 有这个定义。 { block }
12.1 Block
Syntax
Block :
{ StatementList[opt] }
StatementList :
--- Statement
--- StatementList Statement
Semantics
The production Block : { } is evaluated as follows:
1.
Return (normal, empty, empty).
The production Block : { StatementList }is evaluated as follows:
1.
Return the result of evaluating StatementList.
The production StatementList : Statement is evaluated as follows:
1.
Let s be the result of evaluating Statement.
2.
If an exception was thrown, return (throw, V, empty) where V is the exception. (Execution now proceeds as if no exception were thrown.)
3.
Return s.
The production StatementList : StatementList Statement is evaluated as follows:
1.
Let sl be the result of evaluating StatementList.
2.
If sl is an abrupt completion, return sl.
3.
Let s be the result of evaluating Statement.
4.
If an exception was thrown, return (throw, V, empty) where V is the exception. (Execution now proceeds as if no exception were thrown.)
5.
If s.value is empty, let V = sl.value, otherwise let V = s.value.
6.
Return (s.type, V, s.target).
当 {} 里为空的时候, 返回 normal, empty ,根据 15.1.2.1 第7条的描述 7.
If result.type is normal and its completion value is empty, then return the value undefined. 所以 eval("{}") 得到 undefined
当{} 里面不为空的时候, Let sl be the result of evaluating StatementList., 返回 sl的值,


  • 广播剧社江滨柳
  • switch
    6
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
懂了.
{}是代码块语法....
{'aa', 'b'}和{'aa', 'b';}一样的....代码块还有返回值...疯了....
谢谢gainover啊.让我搞懂了很多东西.


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 首页 上一页 1 2
  • 16回复贴,共2页
  • ,跳到 页  
<<返回javascript吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示