Home  >  Article  >  Web Front-end  >  Summary of basic js usage

Summary of basic js usage

php中世界最好的语言
php中世界最好的语言Original
2018-06-04 11:01:061391browse

This time I will bring you a summary of the basic use of js. What are the precautions for the basic use of js. The following is a practical case, let’s take a look.

0/0 ==> NaN(Not a Number)
You can use isNaN() to detect whether the value is NaN

Escape character

var a = 'king\'s'alert (a);
alert(null == undifined) //truealert(null === undifined) //false 数据值相等 类不相等

' single Quotation marks
\n Carriage return and line feed
\r Line feed
\t Horizontal tab character

Variable parameters

function sum(){    var paramsNum = arguments.length; //将parameters的个数传入variable
    var sum = 0;    for(var i=0; i <paramsNum; i++)
    {
      sum += argument[i];
    }  return sum;
}

I believe you read this article You have mastered the case method. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

The use of Polyfill annotations and preventing modifications in JS

JS object inheritanceUse cases Detailed explanation

The above is the detailed content of Summary of basic js usage. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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