Open
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
// Your code here



// Do not change anything from this line down
console.log(matrixBuilder(5))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
let parkingState = [
[1, 0, 1, 1],
[0, 0, 0, 2],
[1, 1, 2, 1],
[2, 1, 1, 1]
]

// Your code here


console.log(getParkingLotState(parkingState))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
let allColors = [
{label: 'Red', sexy: true},
{label: 'Pink', sexy: false},
{label: 'Orange', sexy: true},
{label: 'Brown', sexy: false},
{label: 'Pink', sexy: true},
{label: 'Violet', sexy: true},
{label: 'Purple', sexy: false},
];

function generateLI(color) {
// Your code here

return '<li>'+ color.label + '</li>';


}

function filterColors(color) {
// Your code here
if ( color.sexy === true){
return true
}
}

function generateHTMLFromArray(array) {

let filteredOptions = array.filter((filterColors));
let LIs = filteredOptions.map(generateLI);

let htmlString = '<ul>';
LIs.forEach(function(element) {
htmlString += element;
})
htmlString += '</ul>';
return htmlString;
}

console.log(generateHTMLFromArray(allColors));
//<ul><li>Red</li><li>Orange</li><li>Pink</li><li>Violet</li></ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
// Your code here
function lyricsGenerator (array){

let cadenaDJ = "";
let contador = 0;
for (let i = 0; i<= array.length; i++){
if (array[i]===0 ){
contador = 0;
cadenaDJ += 'Boom';
}
else if (array[i]===1 ) {
contador += 1;
cadenaDJ += 'Drop the bass';
if (contador ===3){
cadenaDJ += '¡¡¡Break the bass!!!';


}
}
}
return cadenaDJ;

}



// Don't change anything below this line
console.log(lyricsGenerator([0,0,1,1,0,0,0]))
console.log(lyricsGenerator([0,0,1,1,1,0,0,0]))
console.log(lyricsGenerator([0,0,0]))
console.log(lyricsGenerator([1,0,1]))
console.log(lyricsGenerator([1,1,1]))
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,30 @@ let parkingState = [
]

// Your code here
function getParkingLotState(parkingState) {
let state = {
totalSlots: 0,
availableSlots: 0,
occupiedSlots: 0
}

for (let i=0; i<parkingState.length; i++){

for (let j=0; j<parkingState[i].length; j++){

if (parkingState[i][j]===1){
state.occupiedSlots+=1;
}else {
if (parkingState[i][j]===2){
state.availableSlots+=1;
}
}
}
}
state.totalSlots = state.occupiedSlots + state.availableSlots;


return state;
}

console.log(getParkingLotState(parkingState))
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,17 @@ let allColors = [

function generateLI(color) {
// Your code here

return '<li>'+ color.label + '</li>';


}

function filterColors(color) {
// Your code here
if ( color.sexy === true){
return true
}
}

function generateHTMLFromArray(array) {
Expand All@@ -30,3 +37,4 @@ function generateHTMLFromArray(array) {
}

console.log(generateHTMLFromArray(allColors));
//<ul><li>Red</li><li>Orange</li><li>Pink</li><li>Violet</li></ul>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
// Your code here
function lyricsGenerator (array){

let cadenaDJ = "";
let contador = 0;
for (let i = 0; i< array.length; i++){
if (array[i]==0 ){
contador = 0;
cadenaDJ += 'Boom';
}
else if (array[i]==1 ) {
contador += 1;
cadenaDJ += 'Drop the bass';
if (contador ===3){
cadenaDJ += '¡¡¡Break the bass!!!';


}
}
}
return cadenaDJ;

}



// Don't change anything below this line
Expand Down