Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Sebastian Medina MedinaGitHub

Block or report user

Report or block MedinaGitHub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View class.js
class Rectangulo{
constructor(alto,largo){
this.alto = alto;
this.largo = largo;
}
getArea(){
return this.alto * this.largo;
}
View map.js
//los mapas
let mapa = new Map();
mapa.set("nombre","sebastian");
mapa.set("edad",21);
console.log(mapa); //{"nombre" => "sebastian"} {"edad" => 21}
//inicializandolo con valores
let mapa2 = new Map( [ ["nombre","sebastian"] , ["edad",21] ]);
console.log(mapa2); //{"nombre" => "sebastian"} {"edad" => 21}
View set.js
let items = new Set([1, 2, 3, 4, 5, 5, 5, 5, 5, 5]);
console.log(items); //Resultado 1,2,3,4,5
items.delete(3);//Resultado 1,2,4,5
//items.clear(); borra todo
let numerosArray = [1,2,3,4,4,4,4,4,];
//con una funcion anonima limpie el arreglo de los repetidos
var clean = (num => [... new Set(num)])(numerosArray);
console.log(clean);//Resultado 1,2,3,4
View set.js
let items = new Set([1, 2, 3, 4, 5, 5, 5, 5, 5, 5]);
console.log(items); //Resultado 1,2,3,4,5
items.delete(3);//Resultado 1,2,4,5
//items.clear(); borra todo
let numerosArray = [1,2,3,4,4,4,4,4,];
//con una funcion anonima limpie el arreglo de los repetidos
var clean = (num => [... new Set(num)])(numerosArray);
console.log(clean);//Resultado 1,2,3,4
View restYspread.js
//Parametros REST
function agregar_alumnos(arr_alumnos, ...alumnos) {
for (alum of alumnos) {
arr_alumnos.push(alum);
}
return arr_alumnos;
}
let arr_alumnos = ["Sebastian"];
let result = agregar_alumnos(arr_alumnos, "scarlet", "seba jr", "scarlet jr");
console.log(result);// Resultado = ["Sebastian", "scarlet", "seba jr", "scarlet jr"].
View interpolate.js
let saludar = nombre => {
let salida = `hola, ${nombre}`;
return salida;
}
console.log( saludar('sebastian') );//Result Hola Sebastian.
View arrowFunction.js
//Funcion normal
var suma1 = function (valor) {
return valor + valor;
}
console.log(suma1(1));//Resultado = 2
//Funcion EC6
let suma2 = valor => valor + valor;
console.log(suma2(1));//Resultado = 2
@MedinaGitHub
MedinaGitHub / codeSeba.txt
Last active Jan 10, 2017
Javascript codes
View codeSeba.txt
Codigos hechos en JavaScript por Sebastian Medina
1)"Problema del caballo" con un caballo logro recorrer el tablero de ajedrez completo (sin modelo matematico)
https://jsfiddle.net/sebastian007/a66rb1k7/45/
2)Escribir por pantalla Asincronamente
https://jsfiddle.net/sebastian007/hs10fkhn/29/
3)Seccionar una cantidad numerica en distintas partes.
https://jsfiddle.net/sebastian007/j02quhm9/13/
You can’t perform that action at this time.