function extractSubstring(str) {
let startPos = str.indexOf("'");
if (startPos !== -1) {
let endPos = str.indexOf("'", startPos + 1);
if (endPos !== -1) {
return str.substring(startPos + 1, endPos);
}
}
return "";
}
const str = "Node.js is a 'cross-platform', open-source JavaScript runtime environmen";
const substr = "'" + extractSubstring(str) + "'";
console.log(substr);
/*
run:
'cross-platform'
*/