Created
December 28, 2019 14:27
-
-
Save Fhernd/556a9e6ac9e5052f31e516373c16fb64 to your computer and use it in GitHub Desktop.
// Ejercicio 44: Obtener los valores de un arreglo que terminen con un carácter dado.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>jQuery - Ejercicios</title> | |
<link rel="stylesheet" href="css/styles.css"> | |
</head> | |
<body> | |
<h1>jQuery - Ejercicio 44</h1> | |
<h3>Todos los lenguajes de programación:</h3> | |
<ol id="listaLenguajes"> | |
</ol> | |
<h3>Lenguajes de programación que terminan en el carácter l:</h3> | |
<ol id="listaLenguajesFiltrada"> | |
</ol> | |
<script src="js/jquery-3.4.1.min.js"></script> | |
<script src="js/ex044-script.js"></script> | |
</body> | |
</html> |
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
// Ejercicio 44: Obtener los valores de un arreglo que terminen con un carácter dado. | |
$(document).ready(() => { | |
let lenguajes = ['JavaScript', 'Perl', 'C++', 'Python', 'Java', 'Cobol', 'C', 'PHP']; | |
let listaLenguajes = $('#listaLenguajes'); | |
$.each(lenguajes, (indice, valor) => { | |
listaLenguajes.append(`<li>${valor}</li>`); | |
}); | |
let listaLenguajesFiltrada = $('#listaLenguajesFiltrada'); | |
lenguajes = $.grep(lenguajes, (valor) => { | |
return valor.match(/[l]$/); | |
}); | |
$.each(lenguajes, (indice, valor) => { | |
listaLenguajesFiltrada.append(`<li>${valor}</li>`); | |
}); | |
}); |
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
.highlight{ | |
font-style: italic; | |
background-color: #ffff00; | |
} | |
.features{ | |
font-style: italic; | |
background-color: crimson; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment