Truncate A String, freeCodeCamp Review Basic Algorithm Scripting lesson 9

Lesson Summary

In this freeCodeCamp challenge we look at truncating a javascript string. Javascript strings can be truncated with the slice method. The slice method will allow us to extract a section of a string that we specify. The first argument it takes is where you want to start the extraction from. The second is where you want the extraction of the string to end and it will go up to but not include that position. In this challenge we use an if else if condition to solve the challenge.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required