Implementing Array and Variable in Java Script.

0
1356

In this session today we will learn to implement variable and array in java script.

  • To implement arrays and variables in java script follow the steps given below :

  1. Create an new folder on desktop.
  2. Inside that folder create an file index.html
  3. Now right click on file index.html and select an option edit with notepad++.

  4. After it gets opened in Notepad++ write the following code in it.

  5. The notepad++ window will look like as shown below :

  6. And the output of the window is shown below:

  7. Now write the following code in an Notepad++ window.

  8. Your window will have the following look :

  9. The output of the following window is as follows :

  10. We can also concatenate the string ,so for concatenating the string write the code given below in single quote.

  11. Your coded Notepad++ window will look like as shown below :

  12. So you will have the following output window:

  13. Let’s take another example for declaring a variable,so write the following code in Notepad++ window.

  14. So after writing the code your Notepad++ window will look like as shown below :

  15. After running it on browser you will have following Output :

  16. Now let’s learn to display the array element,so for displaying it write the following code in Notepad++.

  17. Your coded window will have following look :

  18. You will have following output :

  19. We can also add an next element in an array and access it by calling its index value,so to do it lets write the following code :

  20. The Notepad++ window will look like this:

  21. You will have the following output :

  22. We can also declare an array using square bracket.


  23. You will have following output :

  24. An array is an object and Object has the properties,so to understand it write the following code :

  25. Your coded window will have the following look :

  26. You will have the following output :

  27. Thus we have learnt to implement arrays and variables in Java Script.

LEAVE A REPLY

Please enter your comment!
Please enter your name here