morseCodeReplacements.js

    0

    0

    function morseCodeReplacements(morseCode) { let result = []; let newStr = ""; for (let i = 0; i < morseCode.length; i++) { let current = morseCode[i]; let next = morseCode[i + 1]; if (current === "." && next === ".") { newStr = morseCode .slice(0, i) .concat("--") .concat(morseCode.slice(i + 2)); result.

    function morseCodeReplacements(morseCode) {
        let result = [];
        let newStr = "";
        for (let i = 0; i < morseCode.length; i++) {
          let current = morseCode[i];
          let next = morseCode[i + 1];
          if (current === "." && next === ".") {
            newStr = morseCode
              .slice(0, i)
              .concat("--")
              .concat(morseCode.slice(i + 2));
            result.push(newStr);
          }
        }
        return result;
      }
      
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.