Learn more about number typesNumber type, as one of the basic data types of JS, is applied in various scenarios in the program, and its importance is like numbers for our daily life.Below let us come together in-depth understanding under, for later "
The
parseint function of JavaScript
The parseint function of JavaScript, we all know what it is.
But you know
How much does parseint ("07") return?
How much is parseint ("08") returned?
The correct answer is
parseint ("07") returns 8
parseint ("08")
Below through the code for you to explain, specifically see below:
IE browser and non IE browser is the difference is that IE browser support activexobject, but not IE browser does not support ActiveXObject. When the IE11 browser has not yet
A Undefined type
Only one value undefined
In the following three cases typeof return type is undefined
1. When the variable is not initialized
2. When the variable is undefined
3. When the function does not have an explicit return value (the
Copy Code code as follows:
parseint ("Hello");//return NAN
parseint ("//return"); 110
So the simple way to judge whether a string is a number is to take advantage of isNaN (), and if true, the string is not a number, otherwise it is a
1.NaNIn JavaScript, Nan represents "not a number". This value is returned primarily when parsing a string error:
Copy Code code as follows:
> Number ("xyz")
Nannan
The name is "not a number", but it can also be said not to
Today in the program appeared a bugger, debugging for a long time, finally found that the original is this problem.
An experiment was done:
Alert (parseint ("01")), when the value inside this is 01==== 07 o'clock is normal, but in "08", "09" will
In this article, you'll share tips on javascript. These tips may help you solve some of the problems in your actual work.
Use!! Operator Conversion Boolean value
Sometimes we need to check whether the value has a valid value for a variable or not,
The answer is b=1,c=0.
parseint () is used to parse the string, and the return value is an integer. There are several features:
1, ignoring the first and last spaces of the parsed string, that is: "111" and "111" are the same
2), formal format
In JS, data type conversion is divided into explicit data type conversion and implicit data type conversion.
1, explicit data-type conversions
A: Turn the number:
1) Number conversion:
Code:
JavaScript Number Object---------Number object is the wrapper object for the original numeric value.Create a Number Objectvar num = new number (10);var num = number (10); ---parentheses are the values of the number object that you want to create or
1. Logical Non-
Logic is not used! Indicates that a value of any type can be applied to the ECMAScript, and the logical non operation returns a Boolean value (True/false). The operator first converts its operand to a Boolean value, and then it is
Instanceof and typeof in JavaScript are often used to determine what type of variable is (an instance), but their use is different:
typeof operatorReturns a string that is used to represent the data type of an expression.
typeof expression;
The
Variables in JavaScript also support free type conversions as applicable (or required) content for ease of use.
Weak-type JavaScript does not convert from the actual variable type to the desired data type according to the programmer's wishes, such
One of the core features of JavaScript ECMAScript has many similarities with Java, C, and Perl, many of which are borrowed from these languages, and there are many differences between them. The basic features of some ECMAScript are listed
Number object is a digit, and its construction method:
Copy Code code as follows:
var num = 10;
var num = new number ();//num = = 0
var num = new number (value);
Where value is a numeric value or a quantity that can be
String String Object
1. Introduce
String object that operates on strings, such as intercepting a substring, finding a string/character, converting case, and so on.
2. How to define
2.1 New String (value) constructor: Returns a String object that
Value: The operation of a computer program requires the operation of the value (values).
Data type: A type that can be represented and manipulated is called a data type.
Variable: When the program needs to save the value for future use, it assigns
Data type of javascript:
JavaScript data types are divided into two categories: original Type and Object type
original type:
number, String, Boolean, null, undefined
where null and undefined represent unique members
of their particular
This article focuses on the JavaScript operators, including a unary operator, bitwise operator, Boolean operators of these 3 types, explained a very comprehensive, small partners under the reference
-->
One or one-dollar operator
1, self-reduction
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.