Javascript Values

A piece of information in JavaScript is a value. There are different kinds of values, for example numbers or string. A string value is a word or words enclosed in quotation marks.

Variables contain values. For example variable siteName is assigned the string ‘HTMLcenter’. Another way to express is siteName = HTMLcenter, where the equals means ‘set to’, the variable siteName now contains the value HTMLcenter.

Keep in mind that JavaScript is case sensitive. Variable MyName is not the same as myName or myname. Variables can not contain spaces and you shouldn’t choose one of the JavaScript reserved words as name for a variable.

Values

TYPE

Number

String

Boolean

Null

Object

Function


DESCRIPTION

Any numeric value

Characters in quotes

True or False

Empty / No meaning

Any value associated with an object

Value returned by a function


EXAMPLES

1.23456789

“Hi, HTMLcenter!”

False

Did you like this post? Get monthly summary of our new tutorials, posts and tips to your inbox!

No Responses

Post Your Comment

Your email address will not be published.