index.js
// The string that needs to be matched is escaped
The string that needs to be matched is escaped
The string that needs to be matched is escaped
function stringEscape (str) {
  let stringArray = str.toString().split('');
  for (let j = 0; j < stringArray.length; j++) {
    for (let i = 0; i < escapeArray.length; i++) {
      if (stringArray[j] === escapeArray[i]) {
        stringArray[j] = '\\' + escapeArray[i];
      }
    }
  }
  return stringArray.join('');
}
function stringEscape ( str ) { let stringArray = str . toString ( ) . split ( '' ) ; for ( let j = 0 ; j < stringArray . length ; j ++ ) { for ( let i = 0 ; i < escapeArray . length ; i ++ ) { if ( stringArray [ j ] === escapeArray [ i ] ) { stringArray [ j ] = '\\' + escapeArray [ i ] ; } } } return stringArray . join ( '' ) ; }
The string that needs to be matched is escaped
The string that needs to be matched is escaped