Home >Web Front-end >JS Tutorial >Summary of basic js usage
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
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!