The Excerpt Maker

Medium+25 XP

Mission Briefing

The news feed on our smart watches is overflowing. You need to build an Excerpt Maker that aggressively truncates the massive news articles into tiny 5-character previews!

The Concept: String Slicing

The .slice(start, end) method extracts a section of a string and returns it as a new string, without modifying the original string. The item at the end index is not included. Example: "JavaScript".slice(0, 4); // Returns "Java"

The Objective

Your function receives a long article string.

  1. Use .slice() to extract exactly the first 5 characters.
  2. Return that 5-character preview string.

01EXAMPLE 1

Inputarticle = "Breaking News!"
Output"Break"

Constraints

  • Return exactly the first 5 characters.
CoreStrings
JavaScript
Loading...
3 Hidden

Input Arguments

article"Hello World"

Expected Output

Hello

Click RUN to test your solution