Problem is written poorly and is easily misleading, methinks. #7514
dunethomas
commented
sultanshaik
commented
Also, the instructions mention that the three dots not be added if num is less than three.
But here is the expected output that ### contradicts the instruction:
truncate("A-", 1) should return "A...".
truncate("Absolutely Longer", 2) should return "Ab...".
Spartano
commented
the problem lies in what the code completion ask you to do. they just have to remove the "..." from the last 2 statements and add them to the previous 2, so that you can complete the chalenge.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The bug isn't in the code, it's in the writing. The challenge states: "If the num is less than or equal to 3, then the length of the three dots is not added to the string length." Adding to the length of the string sounds like adding characters onto the length of a string. For greater clarity, might I suggest: "If the num is less than or equal to 3, then the additional length of the three dots is not added to the total length tested to determine the truncation point." Or something like that. Anyway, it seemed rather unclear exactly what this challenge was asking for.
Challenge Truncate a string has an issue.
User Agent is:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
.Please describe how to reproduce this issue, and include links to screenshots if possible.
My code: