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
- Each JS statement ends with a semicolon (i called them "Terminators" because they terminate the staement)
- Identifires can only contain letter,numbers,the underscore and the dollor($) sign.
- Identifires can't starts with a number. like 1337x is not legal.
- Identifires are Case Sensitive
- Identifires can be any lenth
- 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
Well in JS there are two types of comments
- Single line comment
- Multi line comment
/* This is a multi Line Comment */
- The number Data Type 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
- The string Data Type To represent string data , you code the srtring within single or double quotation marks like
- The boolean data Type To represent Boolean data you code either the word "true" or "false"
Excercises:-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 :)
- Use the console.log or alert , to Display this simple message:
- 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
- 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
- Take a variable A and print the square value.
HINT:- Well use your comman sence here :p .
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:)