var res = func("10001", 1) console.log(res) function func(str, n){ var sum = 0; var arr = str.split("1"); arr.forEach(function(el, index){ if(ind...