String Ends With in JavaScript

Level 136 keystrokes

endsWith() checks whether "Hello" ends with "lo" and prints true.

JavaScript code

// endsWith() returns true if the string ends with the given text
// "Hello" ends in "lo", so true; often used to check file extensions like ".js"
1console.log("Hello".endsWith("lo"));

Output

true
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.

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

More JavaScript examples at level 1

← JavaScript typing practice