Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
Tiago Correia
@tiagocorreiaalmeida
try this
and tell me what happens
Markus Kiili
@Masd925
@tiagocorreiaalmeida The syntax is nodeList.forEach(callback[, thisArg]);, not nodeList.forEach = callback
Kiwalabye Richard
@xdon55
Hey guys please help me here. tell me the problem with my code. it only returns false.

function mutation(arr) {
  var lowerCaseArr = arr.map(function(x){
    return x.toLowerCase();
  });
   for(var j=0;j<lowerCaseArr[1].length;j++){
     var posOfLetter = lowerCaseArr[0].indexOf(j);
     if(posOfLetter !== -1){
       return true;

     } else {
       return false;
     }
   }
}

mutation(["hello", "hey"]);
Markus Kiili
@Masd925
@xdon55 Your code is looking for a number j in the array here lowerCaseArr[0].indexOf(j);
Also, can you really return true if one looped character is found?
Aminu Ibrahim Abubakar
@aminukano585
What do you want to do? @xdon55
Kiwalabye Richard
@xdon55
@AminuSufi585 i want to return false if all letters of second string in arr are not found in the first string. and return true if otherwise.
Aminu Ibrahim Abubakar
@aminukano585
Ok let me check your code I'll get back to you shortly
Aminu Ibrahim Abubakar
@aminukano585
@xdon55 Do it this way
function mutation(arr) {
  var lowerCaseArr = arr.map(function(x){
    return x.toLowerCase();
  });

  for(var j=0;j<lowerCaseArr[1].length;j++){
     var posOfLetter = lowerCaseArr[0].indexOf(lowerCaseArr[1][j]);
     if(posOfLetter === -1){
       return false;
     } 
  }
  return true;
}

mutation(["hello", "hey"]);
You can see that, you need to include the index of the particular characters in the string as well
and also you need to test whether its not found in each iteration
No need of else, if everything was found after the loop
It means it was automatically true
Hope it helps @xdon55
Kiwalabye Richard
@xdon55
@AminuSufi585 thanks. that helped alot
CamperBot
@camperbot
xdon55 sends brownie points to @aminusufi585 :sparkles: :thumbsup: :sparkles:
api offline
Aminu Ibrahim Abubakar
@aminukano585
You're welcome
Gokula Krishna
@AKX-X-32
@Chrono79 thanks for the review
CamperBot
@camperbot
akx-x-32 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
api offline
koder3
@koder3
let data = [
    { avatar_url: 'wwww', name: 'dna', company: 'fb' },
    { avatar_url: 'wwwEw', name: 'dnEa', company: 'fEb' },
  ];
  let data2 = [
    { avatar_url: 'wdwww', name: 'dna', company: 'fdb' },
    { avatar_url: 'wwdwEw', name: 'dnEa', company: 'fEdb' },
  ];

function func(da) {
  return da

}
func(...data);
this is what i get { avatar_url: 'wwww', name: 'dna', company: 'fb' } why dont i get the full data array
Ogundele Olumide
@Lumexralph
@koder3
function func(...da) {
  return da

}
func(data);
koder3
@koder3
@Lumexralph oh thanks. btw any idea why the method i used didnt work?
CamperBot
@camperbot
koder3 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
api offline
Ogundele Olumide
@Lumexralph
@koder3 there's a way you use the rest/spread operator, in the parameters field it spreads the arguments into an array but when used in arguments it kind of spreads the elements in the array into the field and you know that, the first argument passed to a function gets called or used if there's just one parameter... for illustration , some mins pls
Kelechi Chinaka
@ke1echi
:wave: @Lumexralph
Aminu Ibrahim Abubakar
@aminukano585
@camperbot What is api offline?
Ogundele Olumide
@Lumexralph
@koder3 try this see what you get
function func(da1, da2) {
  return [da1, da2];

}
func(...data);  // spreads the array out as arguments so it becomes  func({ avatar_url: 'wwww', name: 'dna', company: 'fb' },  { avatar_url: 'wwwEw', name: 'dnEa', company: 'fEb' })
@kelechy brotherly!
Kelechi Chinaka
@ke1echi
how your day going @Lumexralph
Ogundele Olumide
@Lumexralph
@koder3 so in summary, if spread/rest operator is used with parameter, it gathers the arguments into an array, if it's used with arguments in a function call, it spreads the element of the array out as arguments... that's the simple way I go about it personally
@kelechy been good, at work and feel like sleeping
@kelechy how're you?
Kelechi Chinaka
@ke1echi
:smile:
Ogundele Olumide
@Lumexralph
@kelechy ehn na
Kelechi Chinaka
@ke1echi
good, prepping lesson mat for my kids
Ogundele Olumide
@Lumexralph
@kelechy yeah, school resumption is close
Kelechi Chinaka
@ke1echi
u need am o, but u have to hold till u get home :smile:
Ogundele Olumide
@Lumexralph
@kelechy abi, and on getting home the sleep vanishes :disappointed:
Kelechi Chinaka
@ke1echi
sure...u know how e be, na
Ogundele Olumide
@Lumexralph
i sabi oo
going for lunch bro, be back soon
Kelechi Chinaka
@ke1echi
teaching kids is fun, but the treating from the school is low, i tend to sign out year ending
Ogundele Olumide
@Lumexralph
@kelechy for?
@kelechy go play small for Andela na
go and test your muscles