Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Strings 2/5 | Data Types and Variables
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to JavaScript (staging)

bookStrings 2/5

String length:

We use the length property to check the length of the string.

1
console.log(`JavaScript`.length );
copy
Task

Swipe to start coding

The task is to create a string variable named running and assign the value The horse runs so fast to it. Now check the length or number of characters in the above variable.

Solution

Note: length property also considers the spaces between the string length.

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 20
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain how the length property works with different types of strings?

What happens if the string is empty?

Can you show an example with spaces in the string?

close

bookStrings 2/5

Swipe to show menu

String length:

We use the length property to check the length of the string.

1
console.log(`JavaScript`.length );
copy
Task

Swipe to start coding

The task is to create a string variable named running and assign the value The horse runs so fast to it. Now check the length or number of characters in the above variable.

Solution

Note: length property also considers the spaces between the string length.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 20
single

single

some-alt