forked from b00tc4mp/isdi-parttime-202406
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
carlos
committed
Sep 1, 2024
1 parent
ca08c1f
commit 9eca66b
Showing
3 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//crear función que aplica otra función a todos los valores del array | ||
//crear función simple de prueba | ||
const array=["Los", "gatos", "son", "guay"]; | ||
const result= []; | ||
|
||
function forEach(array, callBackFunction){ | ||
//haz algo | ||
} | ||
|
||
|
||
///////////////////////////////////////////////////////////// | ||
|
||
|
||
function test(element){ | ||
//result[result.length]= element | ||
if (element.length>3){ | ||
result[result.length] = element; | ||
} | ||
} | ||
|
||
/////////////////////////////////////////////////////////// | ||
|
||
{ | ||
function arrayIsEqual(arr1, arr2) { | ||
if (arr1.length !== arr2.length) return false; | ||
let result = true; | ||
let i = 0; | ||
while (i < arr1.length || result === false) { | ||
if (arr1[i] !== arr2[i]) { | ||
result = false; | ||
} | ||
i++; | ||
} | ||
return result; | ||
} | ||
///////////////////////////////////////////////////////////////// | ||
const array1 = [1, 2, 3, 4, 5, 6, 7, 8]; | ||
const result1 = splice(array1, 4); | ||
|
||
console.assert(arrayIsEqual(array1, [1, 2, 3, 4]), { | ||
result: array1, | ||
message: "Test 1.1 no pasado", | ||
}); | ||
console.assert(arrayIsEqual(result1, [5, 6, 7, 8]), { | ||
result: result1, | ||
message: "Test 1.2 no pasado", | ||
}); | ||
} |