JSFiddle - React, Tailwind, and code Playground

by SamFent

JavaScript

function doSomething(msg)
{
  alert( "\"" + msg + "\"" );
  var aLines = msg.split( /\r?\n+/ );

  for ( var i = 0, ii = aLines.length; i<ii; i++ )
  {
     if ( !aLines[i] ) { alert( "Error!" ); continue; }
     alert( i + ": \"" + aLines[i]  + "\"" );
  }
}

doSomething("An item with this x Id already exists. \n An item with this y id already exists. \n An item with this barcode already exists.")