![]() ![]() If you declare a variable without a value, then it is considered to have an undefined value. We have taken cycle as an object, and it has three properties and three values for the same. Now lets see how to declare the objects, JavaScript objects are to be written in a curly bracket. Note: Arrays have to be written in square brackets. We have declared an array sharplesson with three array items. Now we will see, how to declare the arrays using var. Don’t worry we will show the use of it in our examples. Note: If your code requires a conditional testing, then you can use Boolean. Boolean – ExampleĪs we know Boolean has only two values: True or False Note: you can declare any number (decimal or non-decimal) without any double or single quotes. We can use the same var to declare the number as well: Note: You can declare string either in a double quote or in a single quote. Unlike other languages, JavaScript has ‘var’ to hold any value, for example, if you want ‘var’ to declare the string, then you can do like: ![]() Because practical things are easy to understand: String – Example ![]() Now we will try to understand the data types with the use of the examples.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |