Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Lesson 03

In this lesson we learned how to treat numbers and strings.

Contents

First, we learned how to store values returned from prompts, using the following commands:

  1. Number.parseInt(value): Transforms the value to an integer.
  2. Number.parseFloat(value): Transforms the value to a float.
  3. Number(value): Tranforms the value to the type of the number passed as argument.

After that, we learned how to parse values to string:

  1. String(value)
  2. value.toString()

We also worked with templates strings using the ` signal to delimit strings and the ${value} operand to use variables as string.

Finally, we learned some functions to treat strings and numbers:

  1. value.length: return the length of the string value.
  2. value.toUpperCase(): sets all letters of the string value to upper case.
  3. value.toLowerCase(): sets all letters of the string value to lower case.
  4. value.toFixed(*numberOfDecimalCases).replace("whatIsGoingToBeReplaced", "Replacement")
  5. value.toLocaleString('location', {style})

And the document.write(value) command.