Read about javascript string concatenation operator, The latest news, videos, and discussion topics about javascript string concatenation operator from alibabacloud.com
inside .varBoxobject = {};//an empty object was createdalert (boxobject);//[Object Object]AlerttypeofBoxobject);//Boxobject is an object type, the value is [Object Object], and the string returned by the type is also an object varBoxobject =NewObject ();//an empty object was createdalert (boxobject);//[Object Object]AlerttypeofBoxobject);//Boxobject is an object type, the value is [Object Object], and the stri
typeof operatorThe typeof operator (together with instanceof) may be the biggest design flaw in JavaScript,Because it is almost impossible to get the desired results from them.Although Instanceof still has a few application scenarios, typeof has only one practical application: The actual application is used to detect whether an object has been defined or has been assigned a value.This application is not use
One, JavaScript data typeThe data types of JavaScript fall into the following categories:Five simple data types: Undefined,null,boolean,string,number.A complex data type: Object.Second, typeof operatorHere are a few short stories to summarize it, before summing up, first know a very useful operator--typeof.The typeof
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 operator: divided into th
Original: Learn JavaScript from the beginning (iv)--operatorOne or one-dollar operator1. Self-increment self-subtraction operator: divided into pre-and post -type;Front type: ++a;--a;Post-type: a++;a--;Cases:1 Among them a=i++, equivalent to a=i;i=i+1;And B=++j, the equivalent of j=j+1;b=j;2, unary plus minus operator: a=+i;a=-i;1 For integers, a unary minus e
Bitwise anti-operator in Javascript (~)
Bitwise anti-operator in Javascript (~) To perform a bitwise non (evaluate not) operation on an expression. For example ~ 1 =-2 ;~ 2 =-3 ;~ 99 =-100
The Code is as follows:
Result = ~ [Number]
All unary operators (such ~ Operators) are calculated according to the following rul
examples show that the operand of the typeof operator can be a message or a numeric literal. Note that typeof is an operator rather than a function, so parentheses in the example are not required (although they can be used ).
In the above example, we found that the Number created with Number () will also be determined by typeof as an object and the returned value is "object", because the constructor return
JavaScript instanceof operatorThe instanceof operator is used to compare the constructors of the two operands. It is only meaningful to compare a custom object.If used to compare built-in types, it will be as useful as the TypeOf operator.Comparing Custom Objectsfunction Foo () {}function Bar () {}Bar.prototype = new Foo ();New Bar () instanceof Bar; TrueNew Bar () instanceof Foo; TrueIf you only set Bar.pr
Using the typeof operator on a value may return one of the following strings:"Undefined"--if this value is not defined"Boolean"--if this value is a Boolean value"String"--if this value is a string"Number"--if this is a numeric value"Object"--if this is an object or null"Function"--if this value is a function
The return values of the commonly used typeof operator
the first operation determines the result, the second operation is no longer calculated. For logical AND operations, if the first operation is false, no matter what the value of the second operation is, The result cannot be equal to true. Consider the following example: 1 var bTrue = true; 2 var bResult = (bTrue bUnknown); // error 3 alert (bResult ); // This line does not execute the code running result: This line of code will cause an error during the logic AND operation, because the variabl
);
What are you going to do?
If you do not quite understand it after reading it, see the following (people who understand it do not need to read it ):Typeof is a unary operator. It returns a string and returns different results for different operands.The specific rules are as follows:1. For numeric operands, the value returned by typeof is number. For example, for typeof (1), the returned value is number.T
The Javascript bitwise negation operator (~) performs a bitwise non-negation operation on an expression. such as ~ =-2; ~2 =-3; ~99 =-100The code is as follows: result = ~ "number" all unary operators, such as the ~ operator, evaluate the value of an expression according to the following rules: The code is as follows: 1, if applied to an undefined expression or n
Using the typeof operator for a value may return one of the following strings:"Undefined" -- if this value is not defined"Boolean" -- if this value is a boolean Value"String" -- if the value is a string"Number" -- if this value is a numerical value"Object" -- if this is an object or null"Function" -- if this value is a function
The return values of common typeof
The typeof and instanceof operators are used from time to time and are mandatory. These operators may be the biggest design defect in javascript, because it is almost impossible to get the desired result from them to write the comprespt code, the typeof and instanceof operators will be used from time to time and are mandatory. But! Using them is always hard to get the desired results directly, and it is very tangled. It is widely said that "these two
SummaryIn JavaScript, the logical operator "= = =" Checks the data type of the operand first, and returns false for different data types. When the "= =" comparison is performed on different types of operands, the type conversion is then compared.DescriptionTwo logical operators that are judged in javascript:
= = (equal)
= = = (strictly equal/congruen
Core tips: Walkthrough of JavaScript operator Instance
Depending on the number of objects processed:
Cell operator;
binary operator;
Ternary operator.
According to the function:
Assignment operator;
= + = = *=/=%= (take mor
, the right shift n is the equivalent of dividing by 2 of the n-th square. 6.2 Unsigned Right Shift >>>: that is, in binary form, all values, including sign bits, are moved to the right. For positive numbers >> and >>> results are the same;For negative numbers, because negative numbers are expressed in the complement of their absolute values, this results in a very large unsigned right shift.Third, Boolean operators1, logical not !Logic is not used! Indicates that a value of any type that can be
Return Value of the boolean type conversion operator | in javascript, javascriptboolean
Javascript is a weak type language. Any data type can be converted to the boolean type. The conversion rules are as follows:
Value after the data type is converted to boolean
NAN FALSENull FALSEUndefined FALSEObject TRUEFunction TRUE0 FALSENon-zero digit TRUE
"" (Null
Bitwise anti-operator (~) in Javascript (~), Executes bitwise non (evaluate not) operations on an expression. For example ~ 1-2 ;~ 2-3 ;~ 99-100
The Code is as follows:
Result = ~ [Number]
All unary operators (such ~ Operators) are calculated according to the following rules:
The Code is as follows:
1. If it is applied to an undefined or null expression, a runtime error is thrown.2. convert an object t
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.