Hey there welcome once again Hope you are enjoying learning coding :) . In this post i am going to post the answer of those 5 questions which was posted in last blog post.
- Use the console.log or alert , to Display this simple message:
"Hello ! JavaScript"Here is the answer
console.log("Hello ! JavaScript");or you can use the alert method too
alert("Hello ! JavaScript");
var a = 10; /*Assigning the value of a to 10*/ var b = 5; /*Assigning the value of b to 5*/ var c = a+b; /*Telling the interpreter that value of c is equal to sum of a and b */ alert(c); /*Displaying the result */Please follow the comments
var a = prompt("What is your name: "); /*Take a variable a then ask user to enter his/her name nad store the value entered by user into variable a */ alert("Nice to Meet you " + a); /*Now use the alert method to disply the greeting message */
var a = prompt("Please give me a number: ");// store the value entered by user in variable a a = parseFloat(a); // This may sound tricky but we will cover it later var b = Math.pow(a,2); // This is pow method in JS b = parseFloat(b); alert(b); /*Overall this answer may bounce over from your head but don't you worry you will master them all soon just saty tuned and read my next posts */
var first = prompt("Please tell me the length: ");/*store value of length in variable first*/ first = parseFloat(first); /*Now convert the entred value into float*/ var second = prompt("Please tell me the width: ");/*store the value of width in variable second*/ second = parseFloat(second); /*Now convert the entred value into Float*/ var final = (first * second); /*value of final is equal to the multiplication of first and second (variables) */ final = parseFloat(final); /*Again convert the value of final in float with parseFloat*/ alert("The area of rectangle is " + final ); /*Finally display the result like a boss*/So folks i hope you can understand the explained answers and agian if you are facing any problem feel free to comment below and let me know i'll surely help you out
Post a Comment