Cosine Function in JavaScript

Level 125 keystrokes

Math.cos() returns the cosine of 0 radians and prints 1.

JavaScript code

// Math.cos() returns the cosine of an angle given in radians
// At angle 0 the cosine is exactly 1, so 1 is printed
1console.log(Math.cos(0));

Output

1
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
  • ;× 1

More JavaScript examples at level 1

← JavaScript typing practice