how to delete the last part of a string in node js

JavaScript
str = "hello I'm McDown...";
newStr = str.substring(0, str.length - 3); // Returns "hello I'm McDown"
Source

Also in JavaScript: