PROGRAMMING JS
JAVASCRIPT
Para poder practicar con este lenguaje de programación hemos decidido hacerlo en una plataforma llamada Freecodecamp, consta de 110 ejercicios pero aqui te comparto sobre los que mas me han llamado la atención. Si deseas ver más ejercicios básicos de JavaScript puedes dirigirte a mi repositorio de " github".
1. WordBlanks
var myNoun = "dog"; var myAdjective = "big"; var myVerb = "ran"; var myAdverb = "quickly";
// Only change code below this line
var wordBlanks = ""+myNoun+" "+myAdverb+" "+myAdjective+" "+myVerb+""; // Change this line
// Only change code above this line
function switchOfStuff(val) {
var answer = "";
// Only change code below this line
switch (val){
case "a":
answer = "apple";
break;
case "b":
answer = "bird";
break;
case "c":
answer = "cat";
break;
default :
answer = "stuff";
break;
}
// Only change code above this line
return answer;
}
switchOfStuff(1);
3. JavaScript básico: selección de muchas opciones con declaraciones de cambio
function caseInSwitch(val) {var answer = "";
// Only change code below this line
switch(val){
case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";
break;
}
// Only change code above this line
return answer;
}
caseInSwitch(1);
4. JavaScript básico: múltiples opciones idénticas en declaraciones de conmutador.
function sequentialSizes(val) {
var answer = "";
// Only change code below this line
switch(val){
case 1: case 2: case 3:
answer = "Low";
break;
case 4:
case 5:
case 6:
answer = "Mid";
break;
case 7:
case 8:
case 9:
answer = "High";
}
// Only change code above this line
return answer;
}
sequentialSizes(1);
5. Use-recursion-to-create-a-range-of-numbers
function rangeOfNumbers(startNum, endNum) {
if (endNum - startNum === 0) {
return [startNum];
} else {
var numbers = rangeOfNumbers(startNum, endNum - 1);
numbers.push(endNum);
return numbers;
}
}
6. Use-arrow-functions
const magic = () =>{
"use strict";
return new Date();
}
7. Use-the-rest-parameter-with-function-parameters
const sum = (...args) => {
return args.reduce((a, b) => a + b, 0);
}
8.Nesting-for-loops
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
product *= arr[i][j];
}
}
// Only change code above this line
return product;
}
multiplyAll([[1,2],[3,4],[5,6,7]]);
9. Generate-random-whole-numbers-within-a-range
function randomRange(myMin, myMax) {
// Only change code below this line
return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;;
// Only change code above this line
}
PROGRAMACIÓN ORIENTADA A OBJETOS
<Muy pronto>
CSS
<Muy pronto>
Comentarios
Publicar un comentario