Untitled

Run Settings
LanguageJavaScript
Language Version
Run Command
function toArr(){ // console.log(this); return [...this]; } String.prototype.toArr = toArr; const str = 'rdgferv5'; console.log(str.toArr()); console.log('kjklkdjhfojirvldmnfbvs'[1].toUpperCase()); function accum(s) { let res =''; for (let i=0; i<s.length; ++i){ let current=s[i]; res+=current.toUpperCase(); let j=i; while(j>0){ res+=current.toLowerCase(); j--; } res+='-'; } return res.slice(0, -1); } function countPositivesSumNegatives(input) { if (typeof input === 'object' && input.length !== 0 && input !== 'null') { let res = [0, 0]; for (let i=0; i<input.length; ++i){ input[i] > 0 ? res[0]= res[0]+1 : res[1] = res[1]+input[i]; } return res; } else { return [] } } console.log(typeof null); console.log(countPositivesSumNegatives(null));
Editor Settings
Theme
Key bindings
Full width
Lines