20160109 minor Problems

Source: Internet
Author: User

1. After omitting Var, the variable has global scope

When reading a book, I see that if you omit the var keyword from the function, the variable will automatically have the global scope.

function Showscope () {
Scope= ' local ';
return scope;
}
Console.log (scope);//Report Scope undefined error

Here, you define a variable in the Showscope function, does not use scope, but can not find the function, and later found that because the function is not running at first, only after the call once the code is executed, so the natural direct output scope will be an error.
So here's a little pit to call the function once before you can use this global variable. And if there is already a global scope variable, after calling the Showscope function, the ' local ' assignment to scope actually re-alters the value of scope.

function Showscope () {
Scope= ' local ';
return scope;
}
Console.log (Showscope ());//local
Console.log (scope);//local

2. After the editor is transferred from sublime text to Webstorm
After the editor goes from sublime text to Webstorm, the browser address bar is found by the previous file:///... Became localhost:63342/..., and webstorm the previous level of the Webstorm directory under the relative path access setting will also error.
This is because sublime directly open the page, and Webstorm comes with a small server, it is the small server to open the page, set up the Webstorm project directory, you can only access the contents of the directory, and do not jump out of this directory to access other content.
A little understanding of the individual is not yet known whether it is correct

20160109 minor Problems

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.