Basic Introduction To JavaScript

Here in this blog we will give some overview on the basic concepts related to JavaScript and values in JavaScript.

About JavaScript :
JavaScript is a scripting language which is used for making your website dynamic. Writing JavaScript code together with CSS and HTML can make your website more interactive and responsive. Instead of showing static content which will make your users to hit the close button, you can now hold your users’ interest to your website.

Values in JavaScript :
Everything a computer’s memory hold is Data and representing Data in JavaScript is called Value. Values need to be distinguished based on their role. So, JS divides its value to 6 different type.

  • Number
  • String
  • Boolean
  • Undefined
  • Function
  • Object

Number :

It helps you to represent the numerical data in JS. There are several arithmetic operations like addition , subtraction , multiplication, division, modulus etc. which acts on the numeric values in order to perform mathematical calculations. Calculations in whole number will give us the precise value in JS but there might be some approximation taken when dealing with non-whole numbers calculations in JS. If you really want to represent a very big number (like astronomical numbers) in JS, you can use the ‘ e’ syntax (stands for exponential ).

e.g. var number = 10*e5; or var number = 10*e-10;

Strings:

It helps you to represent any character in JS but make sure to keep them inside quotes (the starting quote needs to match with the ending quote). Strings can’t be multiplied, divided, subtracted but we can add them. Concatenation is the way in which we can add two strings, for that we use ‘+’ operator.

e.g. var data = 'two' + 'strings';
data will give us the result twostrings.

Boolean:

It holds a value which distinguishes between two possibilities true or false.
Logical operator is used for Boolean values.
&& (Logical And) : It is a binary operator. If both the values applied to it are true then only the result is true
||(Logical Or) : It is a binary operator. If any of the values applied to it is false then the result is false else it will be true
! (Logical not) : It is a unary operator. It used for flipping the value. When we give it true, we get the result as false, the same works for false also.

Undefined :

It denotes the absence of a meaningful value. There are two values one is null and another is undefined which don’ t carry any meaningful information. There are some differences between null and undefined , one of them is their type — typeof(null) is object but typeof(undefined) is undefined

Function :

A piece of program wrapped in brackets in order to produce a value is called a function. Function may return a value or it may produce any visible clue or internal state change. You can also write a function which does the both.

Objects :

Objects are the value that allow us to group different types of value (object also).
Objects consist property which will contain any value (functions also). By using these properties, we can manipulate with the Object.

Closing Notes :
Thanks for reading. Kindly let me know about the points which I missed, I will describe about each value types in JS in more details in the next blog and please click on the clap button If you found this blog helpful.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *