[core][js][bug] fix word slicing