What I did (in code):
console.log('BEn BoOrstEiN'.toUpperCase())
// BEN BOORSTEIN
console.log('BEn BoOrstEiN'.toLowerCase())
// ben boorstein
console.log(Math.round(5.6))
// 6
console.log(Math.floor(5.999))
// 5
console.log(Math.ceil(5.1))
// 6
console.log('Ben Boorstein'.substr(4, 5))
// Boors
console.log('Ben Boorstein'.substr(2, 4))
// n Bo
console.log('Ben Boorstein'.substr(6))
// orstein
What I did (in English):
- Above are a few of the very many methods that are built in to JavaScript.
-
toUpperCase()
is pretty self-explanatory: It converts the string before it to all uppercase letters. -
toLowerCase()
is pretty self-explanatory: It converts the string before it to all lowercase letters. -
Math.round()
rounds the number passed to it to the nearest integer. -
Math.floor()
rounds the number passed to it to the nearest integer less than or equal to the number. -
Math.ceil()
rounds the number passed to it to the nearest integer greater than or equal to the number. -
substr()
returns a section of the string before it. The first number passed to it represents the starting index. The second number passed to it represents how many of the next characters (including the character at the starting index) will be included. If there is no second number passed to it, then every character from the starting index through the end of the string is included.
What I learned:
- From the above code, I didn't learn anything new. But it is very helpful to be reminded of how these types of methods work. And review, no matter the topic, is always welcome.
- From other parts of this section of instruction, I didn't learn anything new.
What I still might not understand:
- Nothing for this section.
Top comments (0)