# Checking the length of strings and arrays in JavaScript

Suppose we have the variable `str` that stores some arbitrary string:

`let str = '12345';`

Let's write a condition that will print a message to the console if the length of the string is equal to or greater than three characters:

`let str = '12345'; if (str.length >= 3) { console.log('!'); }`

The variable `arr` contains some array with numbers. Write a condition that checks that there are `3` elements in the array. If so, print the sum of the array elements.

←→
↑
en ru