SoManyThingz

Life is 10% what happens to you and 90% how you react to it -Charles R. Swindoll

Wednesday, 26 December 2018

Javascript Algorithms And Data Structures Certification

No comments

Basic Javascript


Comment Your Code:-

          Comments are the lines you write for yourself or for others to understand your code because sometimes you will write a piece of code and then look at back at it days later and not understand what hell did you even wrote that in the first place? Or maybe jsut comment out a piece of your code to see what the problem code is.
  So long story short comments are the lines that will not interfere with your lines of code because Javascript will ignore that line.

How Comment Your Code:-

Well there are two ways to comment  your code in Javascript.
 One way is using "//"    which will make one line of your  text a comment and ignore the remainder

The other way is using /* */  write your text between those and it can cover as many lines as you wish
 for example see below

Data Types in Javascript:- 

First of all you must know that data is anything that is meaningful to computer There are seven different types of data type in javascript which are :-Undefined, null, boolean, string,symbol, number, and object  For example computer distinguishes between numbers, such as  number, 21, and  strings , such as "21","mouse", or "567". As you all must know already that computers can perform mathematical operations on numbers and not strings.

Variables in Javascript:-

 Now variables work as labels for the computers to read and recognize as the given data type. any of the seven data types can be stored in a variable. Variables are similar to to a and b variables you use in mathematical expressions. Computer variables differ some what from mathematical variables in the way that they can store different values at different times.

How to Declare A Variable in Javascript:- 

To  declare a variable in javascript you have to use the keyword "var" and then name it whatever you like using numbers, ltters, @, $ or  _ . But remember there are some reserved word that if you use might give you errors. Example is given below.

Assign A Value to a Variable in Javascript:-

In Javascript we use an assignment operator  to store values in a variables like var myName="jo"; or var myNum = 2; Assignment always goes from left to right of the "=" operator is resolved before the value is assigned to the variables to the left of the operator. For example in the code below var a is assigned the value 7 and var b  is assigned the value of var a.


Initializing A Variable in Javascript:-


Initialize a variable basically means to assign a value to it. like var a = 9; there var a now has an initial value of 9. 


 Javascript is Case Sensitive:- 

Javascript is a case sensitive language meaning if you write a variable named var Myname and another variable var myName both will be recognized as different variables.



Note:If you liked my post then hit the subscribe button!