Skip to content

Commit 5c836eb

Browse files
committed
array or isArray
1 parent e579fb2 commit 5c836eb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

array-exists.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
function bestfriends(friends){
2+
if(Array.isArray(friends)==false){
3+
return 'provide an array'
4+
}
25
let max = friends[0];
36
for(const friend of friends){
47
if(friend.length>max.length){
@@ -7,8 +10,9 @@ function bestfriends(friends){
710
}
811
return max;
912
}
10-
const friendsName =bestfriends(['farhana','nimki','adrita','tirtho','turkiministhan']);
11-
console.log(friendsName);
13+
const friends =['farhana','nimki','adrita','tirtho','turkiministhan'];
14+
const bigBuddy = bestfriends(1113);
15+
console.log(bigBuddy);
1216

1317

1418
/* function bestFriend(friendNames){

string-slice.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const words=anthum.split(' ');
77
const smallSlice = anthum.slice(0,10)
88
// console.log(smallSlice);
99

10+
1011
// substr
1112
const anotherPart = anthum.substr(2,10)
1213
// console.log(anotherPart);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy