Four JavaScript face test your JS basic skills

Source: Internet
Author: User

There are four short JavaScript scripts below, and if you can predict the results of your script, your JavaScript skills will be fine. If the answer is wrong, you can fill out the missing knowledge accordingly. Anyway is very simple, the wrong answer just means you do not understand it, look at the information will soon understand. Then do it first, to see the answer please click the RunCode button. Dancheng Shu Marine Environmental protection

First question
1 vara = 10;
2 sayHi();
3 functionsayHi() {
4     vara = 20;
5     alert(a);
6 }
7 alert(a);

Second question
1 vara = 10;
2 sayHi();
3 functionsayHi() {
4     a = 20;
5     alert(a);
6 }
7 alert(a);

Third question
01 vara = 10;
02 sayHi();
03 functionsayHi()
04 {
05     a = a + 10;
06     alert(a);
07     returna;
08 }
09 alert(a);
10 alert(sayHi()+10);

Question Fourth
01 vara = 10;
02 sayHi();
03 functionsayHi()
04 {
05     vara = a + 10;
06     alert(a);
07     returna;
08 }
09 alert(a);
10 alert(sayHi()+10);

Four JavaScript face test your JS basic skills

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.