Created
August 7, 2019 21:00
-
-
Save parzibyte/7d0a2ff9d6e28c561a4c130cfb22488f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cadena = "Hola mundo"; | |
if(cadena.startsWith("H")){ | |
console.log("La cadena comienza con H"); | |
} | |
if(cadena.startsWith("h")){ | |
console.log("La cadena comienza con h"); | |
} | |
if(cadena.startsWith("Ho")){ | |
console.log("La cadena comienza con Ho"); | |
} | |
// también podemos almacenar el resultado, como siempre | |
let comienzaConB = cadena.startsWith("B"); | |
// Y luego hacer cualquier cosa con la variable | |
if(comienzaConB){ | |
console.log("La cadena comienza con B"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment