function filtrarDormitorios() {
let radioDorm = document.querySelector('input[name="radio-dorm"]:checked').value
let arrayFiltrado = []
for(let i = 0; i < arrayCasas.length; i++){
if(arrayCasas[i].dormitorios == radioDorm) {
arrayFiltrado.push(arrayCasas[i])
} else if(arrayCasas[i].dormitorios >= 3 && radioDorm == "masde3"){
arrayFiltrado.push(arrayCasas[i])
}
}
return arrayFiltrado
}
const vehicles = [
{
name: 'honda civic',
type: 'car'
},
{
name: 'honda accord',
type: 'car'
},
{
name: 'honda goldwing',
type: 'motorcycle'
},
{
name: 'honda unicycle',
type: 'bike'
}
]
const filterVehicles = () => {
const filter = vehicle => vehicle.type === 'car'
return vehicles.filter(filter)
}
filterVehicles()
function filtrarDormitorios(){
let radioDorm = document.querySelector(input[name="radio-dorm"]:checked).value
arrayFiltrado = []
for(let i = 0; i < arrayCasas.length; i++){
if(arrayCasas[i].dormitorios == radioDorm){
arrayFiltrado.push(arrayCasas[i])
}else if(arrayCasas[i].dormitorios >= 3 && radioDorm == "masde3"){
arrayFiltrado.push(arrayCasas[i])
}
}
mostrarListado()
}
#boton:hover {
background: blue;
}
function getRaza() {
var raza = razas[Math.floor(Math.random() * razas.length)]
return raza
}
var animals = ['dog', 'cat', 'horse'];
animals[Math.floor(Math.random() * animals.length)];
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header class="header">
<nav class="header__nav">
<ul class="header__nav-list">
<li class="header__nav-item">
<a href="#" class="header__nav-link">Inicio</a>
</li>
<li class="header__nav-item">
<a href="#" class="header__nav-link">Servicios</a>
</li>
<li class="header__nav-item">
<a href="#" class="header__nav-link">Contacto</a>
</li>
</ul>
</nav>
</header>
<
const autos = [
{
nombre: "auto1",
tipo: "auto"
},
{
nombre: "auto2",
tipo: "moto"
},
{
nombre: "auto3",
tipo: "auto"
},
{
nombre: "auto4",
tipo: "moto"
},
{
nombre: "auto5",
tipo: "auto"
},
{
nombre: "auto6",
tipo: "moto"
},
]
const getAutosAndMotos = (arr) => {
return arr.filter((car) => car.tipo === "auto" || car.tipo === "moto");
};
getAutosAndMotos(autos)
function getRooms(roomType) {
let filtered = [];
for(let i = 0; i < houses.length; i++) {
if(roomType == houses[i].dormitorios || (roomType == "masde3" && houses[i].dormitorios >= 3)) {
filtered.push(houses[i]);
}
}
return filtered;
}
<html>
<head>
<title>Manejando datos</title>
</head>
<body>
<script>
let personas = []
let div_todos = document.createElement('div')
let div_adultos = document.createElement('div')
let tabla_todos = document.createElement('table')
let tabla_adultos = document.createElement('table')
let btn_todos = document.createElement('button')
let btn_adultos = document.createElement('button')
let div_contenido = document.createElement('div')
let btn_guardar = document.createElement('button')
let btn_mostrar = document.createElement('button')
let input_nombre = document.createElement('input')
let input_edad = document.createElement('input')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<header>
<img src="https://media.istockphoto.com/vectors/ice-cream-logo-template-vector-id912894570?k=6&m=912894570&s=612x612&w=0&h=y7C9q3O8WfNhQa69ykJNlmjvY8hzwE1rLHJxxrT9Tv8=" alt="logo">
<nav>
<ul>
<li><a href="#">Inicio</a></li>
<li><a href="#">Servicios</a></
function filtrarDormitorios(array, radioDorm){
let arrayFiltrado = [];
for(let i = 0; i < array.length; i++){
if(array[i].dormitorios == radioDorm){
arrayFiltrado.push(array[i])
}else if(array[i].dormitorios >= 3 && radioDorm == "masde3"){
arrayFiltrado.push(array[i])
}
}
return arrayFiltrado
}
function fibo(lim) {
var fib = [1,1];
var x = 2;
while(x<lim) {
fib.push(fib[x-1]+fib[x-2]);
x++;
}
return fib;
}
fibo(20);
.nav ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 200px;
background-color: #f1f1f1;
border: 1px solid #555;
}
.nav li a {
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}
.nav li a:hover {
background-color: #555;
color: white;
}
.nav li.header {
background-color: #555;
color: white;
}
.nav li.active a{
background-color: #ff0000;
color: white;
}
#boton {
width: 20px;
height: 10px;
}
#boton:hover {
background: blue;
color: white;
}
function calcCantidad(arrZapatos, nacional) {
var cantidad = 0;
for (var i = 0; i < arrZapatos.length; i++) {
if (arrZapatos[i].nacional == nacional && arrZapatos[i].talle > 38) {
cantidad++;
}
}
return cantidad;
}
function validar(zapato) {
var errores = [];
if (zapato.nombre.trim() == "") {
errores.push("Debe ingresar un nombre");
}
if (isNaN(zapato.talle) || zapato.talle < 30 || zapato.talle > 46) {
errores.push("El talle debe ser un valor numérico entre 30 y 46");
}
return errores;
}
var zapatos = [];
function agregarZapato() {
let radioDorm = document.querySelector(input[name="radio-dorm"]:checked).value;
arrayFiltrado = arrayCasas.filter(
function(item){
return item.dormitorios == radioDorm;
}
)
.button {
width: 100px;
height: 20px;
background-color: yellow;
}
.button:hover {
background-color: red;
}
## CSS
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language like HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.
CSS is designed to enable the separation of presentation and content, including layout, colors, and fonts. This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple web pages to share formatting by specifying the relevant CSS in a separate .css file, and reduce complexity and repetition in the structural content.
Separation of formatting and content also makes it feasible to present the same markup page in different styles for different rendering methods, such as on-screen, in print, by voice (via speech-based browser or screen reader), and on Braille-based tactile devices. CSS also has rules for alternate formatting if the content is accessed on a mobile device.
The name cascading comes from the specified priority scheme to determine which style rule applies if more than one rule matches a particular element. This cascading priority scheme is predictable.
The CSS specifications are maintained by the World Wide Web Consortium (W3C
def pick_random_breed():
cat_breeds = ['abyssinian', 'aegean', 'american bobtail', 'american curl', 'american shorthair', 'american wirehair', 'appenzeller', 'balinese', 'bengal', 'birman', 'bombay', 'british shorthair', 'burmese', 'burmilla', 'chartreux', 'chausie', 'cheetoh', 'colorpoint shorthair', 'cornish rex', 'cymric', 'devon rex', 'donskoy', 'dragon li', 'dwelf', 'egyptian mau', 'european shorthair', 'exotic shorthair', 'havana brown', 'himalayan', 'japanese bobtail', 'javanese', 'khao manee', 'korat', 'kurilian bobtail', 'laPerm', 'maine coon', 'manx', 'munchkin', 'nebelung', 'norwegian forest', 'ocicat', 'oriental shorthair', 'peterbald',
let filtrarDormitorios = () => {
let radioDorm = document.querySelector(input[name="radio-dorm"]:checked).value;
let arrayFiltrado = arrayCasas.filter((casa) =>
casa.dormitorios == radioDorm ||
(casa.dormitorios >= 3 && radioDorm == "masde3")
)
mostrarListado(arrayFiltrado)
}
let randomAnimal = () => {
let arr = ['caballo', 'gato', 'perro']
return arr[Math.floor(Math.random() * arr.length)]
}
randomAnimal()
<input type="button" class="button" />
#boton:hover {
background-color: blue;
color: white;
width: 20px;
height: 10px;
}
const vehicles = [
{
type: "car",
model: "Nissan",
color: "blue"
},
{
type: "car",
model: "Ford",
color: "red"
},
{
type: "motorcycle",
model: "Kawasaki",
color: "green"
},
{
type: "motorcycle",
model: "BMW",
color: "black"
}
];
function filterCars(vehicles) {
const result = []
for (var i = 0; i < vehicles.length; i++) {
if (vehicles[i].type == 'car') {
result.push(vehicles[i])
}
}
return result
}
filterCars(vehicles)
function createFilter(radioButton) {
return function(item) {
return item.gender === radioButton.value;
}
}
/*
function createFilter(radioButton) {
return function(item) {
return item.gender === 'male';
}
}
*/
const autos = [
{
marca: 'Toyota',
modelo: 'Celica',
tipo: 'auto'
},
{
marca: 'Toyota',
modelo: 'Corolla',
tipo: 'auto'
},
{
marca: 'Toyota',
modelo: 'Camry',
tipo: 'auto'
},
{
marca: 'Suzuki',
modelo: 'Gixxer',
tipo: 'moto'
},
{
marca: 'Suzuki',
modelo: 'VStrom',
tipo: 'moto'
},
{
marca: 'Suzuki',
modelo: 'Bandit',
tipo: 'moto'
},
{
marca: 'Suzuki',
modelo: 'DR650',
tipo: 'moto'
},
{
marca: '
var vehiculos = [
{
marca: 'ford',
tipo: 'auto'
},
{
marca: 'honda',
tipo: 'moto'
},
{
marca: 'chevrolet',
tipo: 'auto'
}
]
var cars = [
{ type: 'car', model: 'toyota' },
{ type: 'car', model: 'ford' },
{ type: 'motorcycle', model: 'ninja' },
{ type: 'motorcycle', model: 'ducati' }
]
var carros = cars.filter(car => car.type === 'car')
var motos = cars.filter(car => car.type === 'motorcycle')
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main()
{
int opcion;
srand(time(NULL)); /* Genera una semilla para los números al azar */
printf("¿Qué tipo de gato quieres?\n");
printf("1: Mainecoon\n2: Ragdoll\n3: Persa\n");
printf("Opción: ");
scanf("%d", &opcion);
switch (opcion)
{
case 1:
printf("Tu gato es un mainecoon\n");
break;
case 2:
printf("Tu gato es un ragdoll\n");
break;
case 3:
printf("Tu gato es un persa\n");
break;
default:
printf("Tu gato es una raza desconocida\n");
break;
}
printf("
<input type="button" class="button" value="haceme click">
function searchLetter(animals, letter) {
let result = []
for(let i = 0; i < animals.length; i++) {
if(animals[i].endsWith(letter)) {
result.push(animals[i])
}
}
return result
}
function searchMoreThan7(animals) {
let result = []
let shorter = 1000
for(let i = 0; i < animals.length; i++) {
if(animals[i].length > 7) {
result.push(animals[i])
}
if(animals[i].length < shorter) {
shorter = animals[i].length
}
}
return result
}
let animals = ['perro', 'gato', 'hamster', 'canario', 'loro', 'tortuga', 'cuyo', 'leon', 'rey']
searchLetter(animals, 'o')
searchMoreThan7(animals)
var boton = document.querySelector('boton');
boton.addEventListener('click', function(){
boton.style.color = 'red';
});
const vehiculos = [
{ tipo: 'auto', color: 'negro', marca: 'ford' },
{ tipo: 'auto', color: 'negro', marca: 'ford' },
{ tipo: 'moto', color: 'negro', marca: 'ford' },
{ tipo: 'moto', color: 'negro', marca: 'ford' },
{ tipo: 'moto', color: 'negro', marca: 'ford' },
{ tipo: 'auto', color: 'negro', marca: 'ford' },
{ tipo: 'auto', color: 'negro', marca: 'ford' },
{ tipo: 'auto', color: 'negro', marca: 'ford' },
{ tipo: 'moto', color: 'negro', marca: 'ford' },
{ tipo: 'auto', color: 'negro', marca: 'ford' },
];
const getAutos = vehiculos.filter(vehic
var breeds = [
'Persian',
'Siamese',
'Ragdoll',
'Sphynx',
'Munchkin',
'Abyssinian',
'Ragamuffin',
'Bombay',
'American Curl',
'Oriental',
'Scottish Fold'
];
function getRandomBreed() {
// your code here
}
getRandomBreed()
function isCar(a) {
return a.type === 'Car';
}
var vehicles = [
{type: 'Car', model: 'A3', color: 'red'},
{type: 'Car', model: 'A3', color: 'red'},
{type: 'Car', model: 'A3', color: 'red'},
{type: 'Car', model: 'A3', color: 'red'},
{type: 'Car', model: 'A3', color: 'red'},
{type: 'Motorcycle', model: 'A3', color: 'red'},
]
vehicles.filter(isCar)
var race = ['persa', 'siames', 'gatoSalvaje'];
var race = race[Math.floor(Math.random() * race.length)];
console.log(race)