Вычислите площадь одного прямоугольника
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?
Что я уже пробовал:
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?