Daily Coding Challenge - Markdown Blockquote Parser

Tell us what’s happening:

i don’t see what’s wrong with my code, i need help.
test no.3 is not passing

Your code so far

function parseBlockquote(markdown) {
  let string = markdown.trim().split(' ');
  let quoted = [];
  if (string[0] === '>') {
    for (let i = 1; i < string.length; i++) {
      if (string[i] !== '') {
        quoted.push(string[i])
      }
    }
  }
  let newString = '<blockquote>' + quoted.join(' ') + '</blockquote>';
  return newString;
}
console.log(parseBlockquote("> So Is This")) 

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 OPR/124.0.0.0

Challenge Information:

Daily Coding Challenge - Markdown Blockquote Parser
https://www.freecodecamp.org/learn/daily-coding-challenge/2025-12-17

i did a few tweaks from your code snippet it passes, here are those:

  • split with “>” and trimmed it after again
  • removed initial string[0] check
  • removed ‘if’ check within ‘for’ loop
  • in new string joined them with no space

NB: have you tried using regEx and ‘matchAll’ for this challenge, it becomes a lot more easier and readable…

happy coding :slight_smile:

Thanks it passes, i did what you say

1 Like