-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbt1.js
36 lines (23 loc) · 1.01 KB
/
bt1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// //1. How to check a variable’s type?
// let name1 = ("phong");
// let so1 = 22;
// console.log (name1 + ` => `+ typeof name1);
// console.log (so1 + ` => ` + typeof so1);
// // invalid name
// const name2 = 'phong123';
// const name2 = 'p123';
// //Uncaught SyntaxError: Identifier 'name2' has already been declared
// const = 'phong1234';
// //Uncaught SyntaxError: Unexpected token
// //Missing a variable name
// const if = 11;
// //Uncaught SyntaxError: Unexpected token 'if'
// //Reserved keywords can't be variable names
// //2.Write a program that calculates the area of a circle. The circle radius is entered by users
// const usin1 = Number(prompt("radius?"));
// const area1 = usin1 * usin1 * 3.14;
// console.log(`Area = `+ area1);
// //3.Write a program that converts Celsius (0C) into Fahrenheit (0F)
// const tempc = Number(prompt("Enter the temperature in Celsius?"));
// const tempf = tempc * 1.8 + 32;
// console.log(tempc + ` (C) = ` + tempf.toFixed(1) + ` (F)`);