Ved Prakash JavaScript Exercise Session 1st | codinggiri GuidePedia


Hey There ! Hope you are enjoying your Learning. Today I am going to Post 5 problem in JS so that you can solve those with JS Approch. Before starting to solve Problems Please Go through a Quick Look to basic JS Rules etc.

The Basic Syntax Rules of JS

  1. JavaScript is Case Sensitive. Thats Means Java, JAVA and java are three diffrent things for JavaScript Interpreter
  2. JavaScripts Ignore the extra whitespaces within statements
  3. Each JS statement ends with a semicolon (i called them "Terminators" because they terminate the staement)

Rules for Creating Identifires in JavaScripts

  1. Identifires can only contain letter,numbers,the underscore and the dollor($) sign.
  2. Identifires can't starts with a number. like 1337x is not legal.
  3. Identifires are Case Sensitive
  4. Identifires can be any lenth
  5. Identifires can't be the same as represented words(KeyWords).The list of KeyWords or Reserved Words below

Don't be confuse about Identifires. Identifires are the name we give to the variables , objects, functions, properties and methods like var ved = 5;. Here ved is the name i gave to the variable so it's (ved) is an Identifire

Using Comments in JavaScript

Comments are very Important part of any programming language.Just imagine that you are a programmer(don't just imagine, feel it :) ) , You wrote some lines of code of any software or website and you coded it very rough so that only you are able to understand the code easily , for others it will be pain in ass to understand the code but if you commented your code nicely it will not only help the other developers to understand the code but it will help you too. So it's always a good desition to comment your code
Well in JS there are two types of comments
  1. Single line comment
  2.  //This is a single line of comment in JavaScript
  3. Multi line comment
      This is a multi Line Comment

JavaScript Data Types

Programming is more like playing/manuplating with data (we input data and we get data stuff) and there are Data Type to perform diffrent kind of manuplation. Let's Have a Quick look to it.

JavaScript provide three primitive(again don't confused iwth "primitive" we will cover it later )
  1. The number Data Type
  2. Number data type can be used to represent either integers or decimal values. Integers are whole numbers like 45,98,64,6,8, etc. and decimal values are number that can have one or more decimal digits. like 34.5, 56.8, etc
  3. The string Data Type
  4. To represent string data , you code the srtring within single or double quotation marks like
  5. The boolean data Type
  6. To represent Boolean data you code either the word "true" or "false"


There are 5 question in this series. Please don't cheat if you really want to be a good developer.(I will Post the Solution with code and description so that you can have a better understanding of Js and once again Please don't Cheat :)
  1. Use the console.log or alert , to Display this simple message:
    "Hello ! JavaScript"
  2. Take three variables a,b and c. assign some integer values to first two variables a nd b. now show assign (a and b) sum (+) , diffrence(-) and multiplication(*) values in to variable c
    HINT: use mathematical operators and use console.log or alert to display outputs

  3. Take a variable A, now use prompt to ask user his/her name and print a greeting message.
    HINT:- You have to store the value of what user will input into the variable A. Later then you can use console.log or alert to display the greeting message

  4. Take a variable A and print the square value.
    HINT:- Well use your comman sence here :p .

  5. We are going to find out the area of a rectangle so for that Take Three variables named first,second and Final. use prompt to ask user to give the length and width, then store the area of rectangle into third variable and finally print the area.
    HINT:- formula is [area of rectangle = Length x Width]

Practice it and i will post the solution with code and description in next post:)

Post a Comment