pastebin

Paste Search Dynamic
Recent pastes
numbers
  1. let numbers = [2, 3, 5, 7, 11, 13, 17, 18, 19];
  2. let str = "";
  3. for (let i = 0; i < numbers.length; i++) {
  4.     if (i % 2 === 1)
  5.         continue;
  6.     str += (str === "" ? "" : "-") + numbers[i];
  7. }
  8. //str is "2-5-11-17"
  9. console.log(`str is "${str}"`);
Parsed in 0.002 seconds