Hướng dẫn thử thách
1 / 1
Implement the Truncate a String Algorithm
In this lab, you will practice truncating a string to a certain length.
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should have a function `truncateString` that accepts two arguments, the first one a string, the second one a number.
1. If the length of the string is more than the given number, the string should be truncated to reduce the length so that it is equal the given number, and `...` should be appended at the end of the truncated string.
1. If the length of the string is equal to or lower than the given number, the string should be returned unchanged.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.js
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵