Skip to content

Commit

Permalink
update changes to Array and Arroz to issue b00tc4mp#65
Browse files Browse the repository at this point in the history
  • Loading branch information
Thea272 committed Oct 12, 2024
1 parent 4337bf8 commit 3597765
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 6 deletions.
3 changes: 2 additions & 1 deletion staff/tea-kintiraia/playground/array/Array.prototype.at.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ console.log('CASE get element at -1000')
var things = [100, true, 'hola mundo', {a:1, b:2, c:3}, null, underfined, function () {return ' hello mundo'}]
var element = things.at(-1000)
console.log(element)
//underfined
//underfined
4
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


Array.prototype.concat()

var array1 = ['any', 'some', 'none', 'lot'];
Expand All @@ -9,4 +11,5 @@ const array3 = array1.concat(array2);


console.log(array3);
//La respuesta esperada: Array ['any', 'some', 'none', 'lot', 10, 11, 12, 13]
//La respuesta esperada: Array ['any', 'some', 'none', 'lot', 10, 11, 12, 13]

113 changes: 109 additions & 4 deletions staff/tea-kintiraia/playground/array/Array.prototype.indexOf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
console.log('TEST Array.ptototype.indexOf')

console.log('CASE get index of bison')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('bison')
console.log(index);
// 1

console.log('CASE get index of bison starting at index 2')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('bison', 2)
console.log(index);
// 4

console.log('CASE get index of giraffe')

var beast = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('giraffe')
console.log(index);
// -1

console.log('CASE get index of giraffe at offset -4')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('girraffe', -4)
console.log(index);
//-1

console.log('CASE get index of duck starting at offset -4')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('duck', -4)
console.log(index)
// 3

console.log('CASE get index of duck starting at offset -3')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('bison', -3)
console.log(index);
// 4

console.log('TEST Array.ptototype.indexOf')

console.log('CASE get index of bison')
Expand All @@ -7,16 +51,77 @@ var index = beasts.indexOf('bison')
console.log(index);
// 1

console.log('CASE get index of bison starting at index 2')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('bison', 2)
console.log(index);
// 4

console.log('CASE get index of giraffe')

var beast = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('giraffe')
console.log(index);
// -1

console.log('CASE get index of giraffe at offset -4')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('girraffe', -4)
console.log(index);
//-1

console.log('CASE get index of duck starting at offset -4')

var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('duck', -4)
console.log(index)
// 3

console.log('CASE get index of duck starting at offset -3')

var drinks = ['tea', 'coffe', 'milk', 'water', 'beer']
var beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
var index = beasts.indexOf('bison', -3)
console.log(index);
// 4

console.log('drinks', drinks)

console.log('indexOf coffe->', drinks.indexOf ('coffee'))
var drinks = ['tea', 'coffee', 'milk', 'water', 'coffee']
var index = drinks.indexOf('vine')
console.log(index)
//-1


console.log('CASE get index of coffee starting at offset -2')
var drinks = ['tea', 'coffe', 'milk', 'water', 'coffee']
var index = drinks.indexOf('coffee', -2)
console.log(index)
//1

console.log('indexOf vine ->', drinks.indexOf('vine'))
console.log('CASE get index of coffee starting at offset 1')
var drinks = ['tea', 'coffee', 'milk', 'water', 'coffee']
var index = drinks.indexOf('coffee', 2)
console.log(index)
//4



var drinks = ['tea', 'coffee', 'milk', 'water', 'coffee']
var index = drinks.indexOf('vine')
console.log(index)
//-1


console.log('CASE get index of coffee starting at offset -2')
var drinks = ['tea', 'coffe', 'milk', 'water', 'coffee']
var index = drinks.indexOf('coffee', -2)
console.log(index)
//1

console.log('CASE get index of coffee starting at offset -5')
var drinks = ['tea', 'coffee', 'milk', 'water', 'coffee']
var index = drinks.indexOf('coffee', -5)
console.log(index)
//1

0 comments on commit 3597765

Please sign in to comment.