lundi 10 juillet 2017

Check for Enter value in string

I have a string that is = textarea.value

var str = "one
two
three"

If I loop through the string, what is the value of the Enter key?

for (i = 0; i < str.length; i++) {
  if (str[i] === '????') {   
    console.log('found enter key')
  };
};

note: I know how to check when the enter key is pressed inside the textarea, I would like to check for it using the string.

Aucun commentaire:

Enregistrer un commentaire