Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第 13 期(2019-05-20):无返回值的语句 #15

Open
AMY-Y opened this issue May 20, 2019 · 3 comments
Open

第 13 期(2019-05-20):无返回值的语句 #15

AMY-Y opened this issue May 20, 2019 · 3 comments

Comments

@AMY-Y
Copy link

AMY-Y commented May 20, 2019

        基础
        


        1 请写出四种无返回值的四种语句
        2 判断在浏览器控制台执行以下代码的结果,同时写出原因
        eval('1+2;var x=5;;;;;;function fn(){};');
        eval('1+2;var x=5;;;;;;function fn(){};void 0');
@wingmeng
Copy link
Collaborator

[黑人问号脸.jpg],真的看不懂啊 😂

@AMY-Y
Copy link
Author

AMY-Y commented May 21, 2019

哈哈哈哈哈

@AMY-Y
Copy link
Author

AMY-Y commented May 21, 2019

  无返回值的四种语句://其他语句都有返回值
;//只有一个分号的空语句
var a=3;//变量声明
function fn(){};//函数声明
break,continue;//等的控制语句
//eval将字符串形式的表达式转换为表达式形式执行。返回的是  最后执行到的   有返回值的  那条语句
//void运算符 会将表达式忽略,返回一个undefined
eval('1+2;var x=5;;;;;;function fn(){};');//返回1+2的结果   3
eval('1+2;var x=5;;;;;;function fn(){};void 0');//返回 void 0 的结果undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants