Open VijaytParmar opened 2 years ago
In String's truncateWords function there is a one mistake of > instead of < in if condition, That's why trucateWords not work properly
if(num > arr.length) => This will not work properly This will slice array if word count is greater than total number of words, which is wrong
if(num > arr.length)
instead,
if(num < arr.lenght) => this will work properly This will slice array if word count is less than total number of words, which is right
if(num < arr.lenght)
and now trucateWords work properly
In String's truncateWords function there is a one mistake of > instead of < in if condition, That's why trucateWords not work properly
if(num > arr.length)
=> This will not work properly This will slice array if word count is greater than total number of words, which is wronginstead,
if(num < arr.lenght)
=> this will work properly This will slice array if word count is less than total number of words, which is rightand now trucateWords work properly