[JS] How can I shorten a response length? | Sololearn: Learn to code for FREE!


[JS] How can I shorten a response length?

Hi, so lets say I have a response that ranges between (200 characters and 9000 characters) I want it to always console log 1950 or less, if it's more than 1950 I want it to only show the first 1950 characters. Is that possible in JavaScript?

12/13/2018 6:53:03 PM

Joe Smith

3 Answers

New Answer


You have to replace the console.log function keeping yourself a string buffer which output at max 1950 chars


Here a fast example https://code.sololearn.com/WeRgoe9rC56S/


How do I do the "outputs max 1950 chars", that's the question