Home > Web Front-end > JS Tutorial > body text

Details in JavaScript

高洛峰
Release: 2016-11-26 13:07:10
Original
1121 people have browsed it

The inability to climb high mountains is not because of lack of physical strength, but because of a grain in your shoe. The same is true for learning, so it is necessary to learn the details that are common in JavaScript and different from other languages.

JavaScript is case-sensitive: Variables and functions in JavaScript are case-sensitive, for example:

[javascript]
function myfunction(){} is different from
function myFunction(){}
function myfunction(){} Different from
function myFunction(){}, the core objects Array, Object, etc. in JavaScript are also case-sensitive.

Single quotation marks and double quotation marks: This question arises when I am learning how to concatenate the string "select * from page where name='lida'" in SQL Server: Are the three ''s at the end preceded by double quotes or single quotes? If you have learned a lot, you will know that double quotes are used by programming languages, and single quotes are used by SQL server to indicate the string type. However, there is no special difference between single quotes and double quotes in JavaScript. Both can be used to create strings. However, in general, JavaScript uses single quotes, and attribute values ​​such as HTML must use double quotes. At the same time, single quotes can include double quotes. You can also include single quotes; in special cases, you need to use the escape symbol "", for example:

[javascript] view plaincopyprint?var temp='

What's this?';
var temp= '

What's this?';
The role of brackets: Like other languages, brackets in JavaScript also have two functions. One is used as a separator, for example: (1+ 1)*2; The second function is an expression, for example: (1+1)*2; The second function is an expression, for example: (function (){}) The brackets separated in () are delimiters , the following brackets indicate the execution method.

Function calls and references:

[javascript]
var temp=myFunction();
var temp=myFunction;
var temp=myFunction();
var temp=myFunction;
Because parentheses can represent execution, the first temp represents the return of the myFunction function value, and the second temp represents assigning myFunction to temp. For example: [javascript] view plaincopyprint?

          Semicolons and braces are not necessary in JavaScript, for example, there is no difference between alert('A'); and alert('A'), but there is a difference when running at the if statement , it is best not to omit it. Details in JavaScript

Overloading

JavaScript is prototype-based and object-oriented. There is no overloading like in C#. Here we can call it replacement. No matter whether the function with the same name has the same number of parameters, the program will execute the last function with the same name, such as function alert(){} will override the alert function in JavaScript.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!