1.There are six basic types of values: numbers, strings, Booleans, objects, functions, and undefined values.
2.The standard describes JavaScript numbers as 64-bit floating-point values.
3.One can also use “scientific” notation by adding an e, followed by the exponent of the number: 2.998e8
4.Calculations with whole numbers (also called integers) that fit in 53 bits are guaranteed to always be precise. (11 bits for the sign and position of dot. Ref IEEE 754)
5.Both single and double quotes can be used to mark strings.
6.Strings cannot be divided, multiplied, or subtracted. The + operator can be used on them. It does not add, but it concatenates.
7.typeof operator, which produces a string value naming the type of the value you give it.
8.Strings can be compared. The way strings are ordered is based on the Unicode standard. When comparing strings, JavaScript goes over them from left to right, comparing the numeric codes of the characters one by one.
9.If a program is invalid but inserting a semicolon can make it valid, the program is treated as if the semicolon is there.
10.The word var is used to create a new variable. After var, the name of the variable follows. Variable names can be almost every word, but they may not include spaces and they not start with a digit.
11.You should imagine variables as tentacles, rather than boxes. They do not contain values. They grasp them—two variables can refer to the same value.
12.Reserved key words of JavaScript:
abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with
13.Executing the code in a function is called invoking or applying it. The notation for doing this uses parentheses. Every expression that produces a function value can be invoked by putting parentheses after it.
14.There is a function Math.max, which takes two arguments and gives back the bigger of the two.
15.The function Number converts a value to a number and there are similar functions called String and Boolean that convert values to those types.
16.When Number is called on something like "moo", which does not contain a number, the result will be the special value NaN, which stands for “not a number.” The function isNaN is used to determine whether its argument is NaN.
17. In a few cases, such as the Number function, the first letter of a variable is capitalized. This was done to mark this function as a constructor.
18.A variable without giving it a value and functions that do not return a specific value but are called for their side effects return an undefined value.
19.The expression null == undefined will produce true.
20.When comparing values that have different types, JavaScript uses a complicated and confusing set of rules. In most cases it just tries to convert one of the values to the type of the other value. However, when null or undefined occurs, it produces true only if both sides are null or undefined.
21.0, NaN, and the empty string count as false, while all the other values count as true.
22.When you do not want any automatic type conversions to happen, there are two extra operators: === and !==. The first tests whether a value is precisely equal to the other, and the second tests whether it is not precisely equal.
23.Values given as the condition in an if, while, or for statement do not have to be Booleans. They will be automatically converted to Booleans before they are checked. This means that the number 0, the empty string "", null, undefined, and of course false will all count as false.
24. If you add a nonstring value to a string, the value is automatically converted to a string before it is concatenated. If you multiply a number and a string, JavaScript tries to make a number out of the string.
25.NaN == NaN equals false. Checking whether a value is NaN can be done with isNaN function.
26.The || operator looks at the value to the left of it first. If converting this value to a Boolean would produce true, it returns this left value, and otherwise it returns the one on its right. The && operator works similarly, but the other way around. When the value to its left is something that would give false when converted to a Boolean, it returns that value, and otherwise it returns the value on its right.
相关推荐
8)....Fixed: Silently ignore and fix invalid values in project options EurekaLog 7.2 Hotfix 2 (7.2.2.0), 30-April-2015 1)....Fixed: Confusing message in Manage tool when using with Trial/Pro 2).......
JavaScript in depth: Learn details of ECMAScript 5, from syntax, variables, functions, and object-oriented programming to regular expressions and JSON with lots of examples. Pick a topic and jump in. ...
**Types, Values, and Variables**(类型、值与变量) - **3.1 Number**(数值类型):JavaScript中的数值类型支持整数和浮点数,但不区分两者,所有数值都用相同的内部格式存储。 - **3.2 String**(字符串类型)...
Basic Scripting: Shell Variables Chapter 6. Shell Logic And Arithmetic Chapter 7. Intermediate Shell Tools I Chapter 8. Intermediate Shell Tools Ii Chapter 9. Finding Files: Find, Locate, Slocate ...
Chapter 3 Types, Values, and Variables Chapter 4 Expressions and Operators Chapter 5 Statements Chapter 6 Objects Chapter 7 Arrays Chapter 8 Functions Chapter 9 Classes and Modules Chapter 10 Pattern ...
Values, Variables, And Calculations Chapter 4. Doing The Math:Libraries Chapter 5. Interactive Programs: Console I/O Part 2: Programming Logic Chapter 6. Simple Logic: Basic Branching/Looping ...
Part 1: Getting Started Chapter 1. Introduction to Ubuntu Linux Chapter 2. Installing the Ubuntu Server Chapter 3. Usage Basics: Login, Interfaces, and Help Chapter 4. Managing Software Part 2: ...
:: Pause and Rewind time with Debug Flow. :: Download Action Packs for popular plugins: :: NGUI, 2DToolkit, Photon, iTween... :: Extend Playmaker with Custom Actions. :: Watch tutorials on our ...
2 Flow of Control . . . . . . . . . . . . . . . . . . . . . 2.1 The if Statement . . . . . . . . . . . . . . . . . 2.1.1 A Single if Statement . . . . . . . . . . 2.1.2 Example: Code for a Single if ...
:: Pause and Rewind time with Debug Flow. :: Download Action Packs for popular plugins: :: NGUI, 2DToolkit, Photon, iTween... :: Extend Playmaker with Custom Actions. :: Watch tutorials on our ...
:: Pause and Rewind time with Debug Flow. :: Download Action Packs for popular plugins: :: NGUI, 2DToolkit, Photon, iTween... :: Extend Playmaker with Custom Actions. :: Watch tutorials on our ...
Part 1: This part presents the basics of the language: variables, instructions, tests, string processing, arrays, objects and functions. It also details the specific aspects of JavaScript, its ...
If you want to learn some basic programming concepts, have experience but need help updating your skills, or you’re coming from another language, Beginning JavaScript with DOM Scripting and Ajax can...