codewars / codewars.com

Issue tracker for Codewars
https://www.codewars.com
BSD 2-Clause "Simplified" License
2.09k stars 219 forks source link

``` #3061

Closed obaid-ba closed 1 year ago

obaid-ba commented 1 year ago
function solution ( input, markers, arr = [], i=0 ) {
  input = input.split( "\n" );
  while ( input.length !== 0 ) {
    if ( input[i].indexOf( markers[0] ) !== -1 ) {
      arr.push( input[i].substring( 0, input[i].indexOf( markers[0] ) ) )
      input.splice( i, 1 )
    } else if ( input[i].indexOf( markers[1] ) !== -1 ) {
      arr.push( input[i].substring( 0, input[i].indexOf( markers[1] ) ) )
      input.splice( i, 1 )
    } else if ( input[i].indexOf( markers[1] ) === -1 && input[i].indexOf( markers[0] ) === -1 ) {
      arr.push( input[i] )
      input.splice( i, 1 )
    }
  }
  return arr.join("\n").trim()
};

Originally posted by @obaid-ba in https://github.com/codewars/codewars.com/discussions/3060

Blind4Basics commented 1 year ago

Hi,

if you have an problem with a specific kata, you should post in the discourse of this kata (using the Question flag), or ask in the discord server (in #help-solve. Don't forget the link to the kata (not direct link to the trainer of the kata, tho)).

Cheers