Click here to Skip to main content
14,666,988 members
Rate this:
Please Sign up or sign in to vote.
See more:
Create a new HTML file in Brackets (or any other text editor) and in the bodyof the document,
type the following code between two <script> … </script> tags:
// Calculate the area of a rectangle
var aWidth = 10.5;
var aHeight = 3;
var message = “Area of this rectangle is ”;
var area = aWidth * aHeight;
console.log(message + area);
Run your code by loading the webpage in Google Chrome with the JavaScript console visible and
try and work out what is being outputted and why (look at last week’s tutorial if you have
forgotten how to do this).
Although JavaScript has dynamic types and we do not have to specify them in the code, we
have used 2 types: Strings and Numbers.
Question to consider: Which variables have which types?


What I have tried:

Create a new HTML file in Brackets (or any other text editor) and in the bodyof the document,
type the following code between two <script> … </script> tags:
// Calculate the area of a rectangle
var aWidth = 10.5;
var aHeight = 3;
var message = “Area of this rectangle is ”;
var area = aWidth * aHeight;
console.log(message + area);
Run your code by loading the webpage in Google Chrome with the JavaScript console visible and
try and work out what is being outputted and why (look at last week’s tutorial if you have
forgotten how to do this).
Although JavaScript has dynamic types and we do not have to specify them in the code, we
have used 2 types: Strings and Numbers.
Question to consider: Which variables have which types?
Posted
Updated 17-Oct-20 14:06pm

Rate this:
Please Sign up or sign in to vote.

Solution 1

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

First of all, you forgot to state a question.
This requirement is about lessons and tutorials (boiler plate) you have got earlier. We can't do it for you.


You show no attempt to solve the problem yourself, you have no question, your main effort is pasting the requirement, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100