HTML and CSS Reference
In-Depth Information
Table G-15 JSON Example
Examples
Rules
{ “author”: “Mark Twain”,
“title”: “Tom Sawyer”,
“year”: 1876
}
All string values must be in double quotation marks.
The identifier (field name) must be in double quotation marks
and followed by a colon.
A value cannot be a function or property.
var jsonBooks 5 { “author”: “Mark Twain”,
“title”: “Tom Sawyer”,
“year”: 1876
}
Table G-16 JSON Methods
Method
Description
stringify(object, [replacer,
space])
Converts an object into a JSON string. Replacer and space are optional. Replacer
is a user-defined function used to replace one value with another. Space is an
integer used to place spaces in front of data elements.
parse(string [reviver])
Converts a JSON string into an object. Reviver is optional. Reviver is a user-defined
function used to modify any data further.
toJSON()
Dictates how JSON.stringify will serialize data.
Math Object
The Math object provides the capability of performing calculations. Table G-17
summarizes the Math object properties and methods.
Table G-17 Math Object
Property
Description
E
Base of a natural logarithm (approximately 2.718)
LN10
Natural logarithm of 10 (approximately 2.302)
LN2
Natural logarithm of 2 (approximately 0.693)
LOG2E
Base-2 logarithm of E (approximately 1.442)
LOG10E
Base-10 logarithm of E (approximately 0.434)
PI
Ratio of the circumference of a circle to its diameter (approximately 3.142)
SQRT1_2
Square root of 1/2 (approximately 0.707)
SQRT2
Square root of 2 (approximately 1.414)
Method
Function
abs(x)
Absolute value of x
acos(x)
Arccosine of x
asin(x)
Arcsine of x
atan(x)
Arctangent of x
atan2(y,x)
Arctangent of the quotient of its arguments
ceil(x)
Value of x rounded to the next highest integer
cos(x)
Cosine of x
exp(x)
Exponent of x
floor(x)
Value of x rounded to the next lowest integer
log(x)
Natural logarithm of x
Search WWH ::




Custom Search