Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions the-string-dot-length-property.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
/*

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
// Your code here
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
let lengthOne = stringOne.length; // Length of stringOne
let lengthTwo = stringTwo.length; // Length of stringTwo
let lengthThree = stringThree.length; // Length of stringThree

// Optional: Print the lengths to verify
console.log("Length of stringOne:", lengthOne);
console.log("Length of stringTwo:", lengthTwo);
console.log("Length of stringThree:", lengthThree);