Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 201c95d

Browse files
completed Array methods with indexOf()lastIndexOf()every()some()find()findIndex()from()isArray()flat() methods
1 parent f28eded commit 201c95d

File tree

1 file changed

+114
-1
lines changed

1 file changed

+114
-1
lines changed

‎Array methods/script.js

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,117 @@
311311
// console.log(num);
312312

313313
// INDEXOF METHOD //
314-
314+
// const strings = ['Ali','Turabek','magdan','ganisher','Turabek'];
315+
// console.log(strings.indexOf('Turabek'))
316+
// console.log(strings.lastIndexOf('Turabek'));
317+
318+
// EVERY METHOD //
319+
// const numbers =[1,2,3,4,5,6,7,8,-11]
320+
// const res = numbers.every((item)=> item > 0)
321+
// console.log(res);
322+
323+
// const personas = [
324+
// {
325+
// name:'Florin'
326+
// },
327+
// {
328+
// name:'Florin'
329+
// },
330+
// {
331+
// name:'Florin'
332+
// },
333+
// {
334+
// name:'Florin'
335+
// }
336+
337+
// ]
338+
// const res = personas.every(person => person.name !== undefined);
339+
// console.log(res);
340+
341+
342+
// SOME METHOD //
343+
// const num = [1,2,3,4,5,6]
344+
// const res = num.some(item => item > 7)
345+
// console.log(res);
346+
347+
// const personas = [
348+
// {
349+
// name:'Florin',
350+
// age:17
351+
// },
352+
// {
353+
// name:'Florin',
354+
// age:13
355+
// },
356+
// {
357+
// name:'Florin',
358+
// age:12
359+
// },
360+
// {
361+
// name:'Florin',
362+
// age:10
363+
// }
364+
// ]
365+
// const res = personas.some(person => person.age > 18);
366+
// console.log(res);
367+
368+
// FIND METHOD //
369+
// const personas = [
370+
// {
371+
// name:'Florin',
372+
// age:17
373+
// },
374+
// {
375+
// name:'Florin',
376+
// age:13
377+
// },
378+
// {
379+
// name:'Florin',
380+
// age:12
381+
// },
382+
// {
383+
// name:'Florin',
384+
// age:10
385+
// }
386+
// ]
387+
// const res = personas.find(personas=> personas.name === 'Florin') ;
388+
// console.log(res);
389+
390+
// FINDINDEX METHOD //
391+
// const numbers= [1,2,3,4,5,6,7];
392+
// const res = numbers.findIndex(findThree);
393+
// function findThree(value){
394+
// return value === 3;
395+
// }
396+
// console.log(res);
397+
398+
399+
400+
// FROM METHOD //
401+
402+
// const str = '123456789';
403+
// const res = Array.from(str,mapFn);
404+
// function mapFn(z){
405+
// return Number(z)
406+
// }
407+
// console.log(str);
408+
409+
// const numbers =[1,2,3,4,5,5,4,3,6,7,8];
410+
// const res = Array.from(new Set(numbers));
411+
// console.log(res)
412+
413+
// ISARRAY METHOD //
414+
// const number = [1,2,3,4,'turabek'];
415+
// const str = 'turabek';
416+
// const num = 434;
417+
// console.log(Array.isArray(number))
418+
// console.log(Array.isArray(str));
419+
// console.log(Array.isArray(num));
420+
421+
422+
// FLAT METHOD //
423+
424+
// const arr = [1,[2,[3,[4,[5]]]]];
425+
// const res = arr.flat(Infinity);
426+
// console.log(res);
427+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /