-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththe-string-dot-length-property.js
More file actions
34 lines (27 loc) · 1.05 KB
/
the-string-dot-length-property.js
File metadata and controls
34 lines (27 loc) · 1.05 KB
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
/*
Objective:
Practice using the .length property by calculating the length of
multiple predefined strings and assigning the results to specific variables.
Instructions:
You will be provided with several predefined string variables.
Your task is to:
- Use the .length property to calculate the length of each string.
- Assign the length of each string to its corresponding length variable.
- Ensure that each length variable contains the correct value.
*/
// Starter Code (Pre-filled):
// Predefined strings
let stringOne = "Coding Bootcamp";
let stringTwo = "JavaScript";
let stringThree = "";
// Your task: Assign the length of each string to the corresponding variable
let lengthOne; // Length of stringOne
let lengthTwo; // Length of stringTwo
let lengthThree; // Length of stringThree
// Your code here
lengthOne=stringOne.length;
lengthTwo=stringTwo.length;
lengthThree=stringThree.length;
console.log("length of "+stringOne+": "+lengthOne);
console.log("length of "+stringTwo+": "+lengthTwo);
console.log("length of "+stringThree+": "+lengthThree);