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

Summary of basic js usage

php中世界最好的语言
Release: 2018-06-04 11:01:06
Original
1446 people have browsed it

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 数据值相等 类不相等
Copy after login

' 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;
}
Copy after login

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!

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