[JS] How can I shorten a response length? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[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?

13th Dec 2018, 6:53 PM
Joe Smith
Joe Smith - avatar
3 Answers
+ 1
You have to replace the console.log function keeping yourself a string buffer which output at max 1950 chars
13th Dec 2018, 7:42 PM
KrOW
KrOW - avatar
13th Dec 2018, 8:16 PM
KrOW
KrOW - avatar
0
How do I do the "outputs max 1950 chars", that's the question
13th Dec 2018, 7:43 PM
Joe Smith
Joe Smith - avatar