If I save a sentence that will always be made up of one or two words in a var variable, how do I save the first word in one variable and the second in another, in case the sentence is two words, and to know that ( if the sentence stored in var is one or two words) how can I do an if?.
Use the
split()
javascript function, if the sentence is separated by spaces add(" ")
if it is a different character for example commasvar cad="hola,adios"
use.split(",")