-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexcersise1.txt
69 lines (50 loc) · 1.27 KB
/
excersise1.txt
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Convert the following ES5 code to ES6.
// Template literals
var li = '<li>' +
'<div class="row">' +
'<div class="col-md-4">' +
'<img src="' + moviePoster + '" height="250" alt="" />' +
'</div>' +
'<div class="col-md-8">' +
'<h2>' + movieTitle + '</h2>' +
'</div>' +
'</div>' +
'</li>';
=================================
function multiply(num1, num2) {
return num1 * num2;
}
=================================
function toCelsius(fahrenheit) {
return (5/9) * (fahrenheit-32);
}
=================================
// This function returns a string padded with leading zeros
function padZeros(num, totalLen) {
var numStr = num.toString();
var numZeros = totalLen - numStr.length;
for (var i = 1; i <= numZeros; i++) {
numStr = "0" + numStr;
}
return numStr;
}
=================================
function power(base, exponent) {
var result = 1;
for (var i = 0; i < exponent; i++) {
result *= base;
}
return result;
}
=================================
function greet(who) {
console.log("Hello " + who);
}
=================================
What will be output of following code
const account = {
username: "marijn",
password: "xyzzy"
}
account.password = "s3cret" // (*much* more secure)
console.log(account.password)