Parse Float in JavaScript

Level 132 keystrokes

parseFloat() converts the string "3.14" into the number 3.14 and prints it.

JavaScript code

// parseFloat() reads a decimal number, including the fraction, from a string
// "3.14" becomes 3.14; parseInt("3.14") would drop the fraction and give 3
1console.log(parseFloat("3.14"));

Output

3.14
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this JavaScript code and how often they appear.

  • .× 2
  • "× 2
  • (× 2
  • )× 2
  • ;× 1

More JavaScript examples at level 1

← JavaScript typing practice