Where communities thrive


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

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 2019 18:04
    thecodingaviator closed #31157
  • Apr 01 2019 18:04
    thecodingaviator closed #33788
  • Apr 01 2019 18:04
    thecodingaviator commented #33788
lyett
@lyett

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < multiplyAll.length ; i++)
{
for (var j=0; j < multiplyAll[i].length; j++)
{
console.log(arr[i][j]);
product *= multiplyAll[i];
}
}

// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Myuuks
@Myuuks
@Athaman var myStr = myName + "Thomas " + "and i am swell!"; on this line ?
Keone Martin
@Athaman
yeah @Myuuks you need to have " and i am swell"
Chris Cullen
@123xylem
@adityaparab ha.. Did you see what the demons did?
Samuel Plumppu
@Greenheart
@123xylem There could be two errors: Either the wikipedia-API-url or the ajax-call. I'm afraid I don't have time to help anymore but I recomend you to go through the documentation for jQuery.ajax() and the Wikipedia Search API one more time and verify that you're using the right values :)
Keone Martin
@Athaman
@lyett mulitplyAll is the name of the function, arr is the name of the array. need to change multiplyAll.length to arr.length
Myuuks
@Myuuks
@Athaman i just understand what's wrong, that wasnt that ^^ but thanks
CamperBot
@camperbot
myuuks sends brownie points to @athaman :sparkles: :thumbsup: :sparkles:
:cookie: 405 | @athaman |http://www.freecodecamp.com/athaman
Keone Martin
@Athaman
oh wow, @ myuuks, sorry you're right, you have one after thomas... it's probably worth copy pasting the code here in the formatted code for ease of reading
Markus Kiili
@Masd925
@WapmasterRohan Unicode sort would sort numbers like this:
Darth Skywalker
@adityaparab

@WapmasterRohan : Secondly, if you want to find if particular element exists in array, you don't need to iterate through the array. Array.prototype has a method called indexOf to check if the element exists in the array.

You can just do

arr.sort(function(a,b){
   return a-b;
});
return arr.indexOf(num) > -1 ? arr.indexOf(num) : arr.length;

Note: `indexOf function returns -1 if the element is not present in the array.

Markus Kiili
@Masd925
[15,4,2,33,12,9].sort(); // [ 12, 15, 2, 33, 4, 9 ]
Darth Skywalker
@adityaparab
@123xylem : I am glad I did not :P :P
Rohan Gayen
@WapmasterRohan
thanks @adityaparab
CamperBot
@camperbot
wapmasterrohan sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
Myuuks
@Myuuks
@Athaman the exercice want me to do + anyvariable + stuff
CamperBot
@camperbot
:cookie: 257 | @adityaparab |http://www.freecodecamp.com/adityaparab
Myuuks
@Myuuks
@Myuuks that's why its didnt work ^^
Keone Martin
@Athaman
yeah :) i had another look and see it now
i'm just used to most string concatenation being broken by spaces
Rohan Gayen
@WapmasterRohan
but what is unicode sorting?? @Masd925
lyett
@lyett
many thank Keone Martin, can't believe I missed that...
Keone Martin
@Athaman
sorts things alphabetically @WapmasterRohan instead of by integer value
@lyett it happens ;)
Markus Kiili
@Masd925
@WapmasterRohan MDN: If compareFunction is not supplied, elements are sorted by converting them to strings and comparing strings in Unicode code point order. For example, "Banana" comes before "cherry". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in Unicode order.
Subh Samal
@subhsamal
I have doubt in record collection. Though my code is working I have some doubt .
Rohan Gayen
@WapmasterRohan
thanks @Masd925
CamperBot
@camperbot
wapmasterrohan sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1526 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
@WapmasterRohan And all characters have unicode values between 0 and 65535.
Keone Martin
@Athaman
@subhsamal paste your code?
Subh Samal
@subhsamal

var collection = {
2548: {
album: "Slippery When Wet",
artist: "Bon Jovi",
tracks: [
"Let It Rock",
"You Give Love a Bad Name"
]
},
2468: {
album: "1999",
artist: "Prince",
tracks: [
"1999",
"Little Red Corvette"
]
},
1245: {
artist: "Robert Palmer",
tracks: [ ]
},
5439: {
album: "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

if(value && prop !== "tracks"){ // if (value !== " ") is same as if (value)
collection[id][prop] = value;
}

else if (value !== "" && prop == "tracks")
{
collection[id][prop].push(value);
}
else if (value === "")
{
delete collection[id][prop];

}

return collection;
}

// Alter values below to test your code
updateRecords(2548, "tracks", "Addicted to Love");

Darth Skywalker
@adityaparab

@WapmasterRohan : Every character you see on the screen is encoded in a way that the computer can understand.
There are various methods of character encoding. Earlier, it used to be ASCII now we support various characters from other languages like Hindi, Chinene, ASCII is no longer sufficient to encompass all the characters. So other standards were developed.

One of those standards is Unicode. It comes in variations like UTF-8, UTF-16 etc.

So when you have a character W, it is represented with a unicode encoding in memory. So when they say unicode sorting or ASCII sorting what they mean is that the characters are compared based on the code that represents that character based on the encoding scheme in use. Not necessarily ASCII.

V Arun Kumar
@arunvkumr
@lyett multiplyAll is function name... use arr instead. and product *= multiplyAll[i](if multiplyAll is assumed to be the array) then this represents sub array so you are multipling subarray with product, i don't think it works that way.. try using both i and j
Subh Samal
@subhsamal
collection[id][prop] = value; @Athaman How can I use push here
Keone Martin
@Athaman
@subhsamal since you check if (prop === "tracks") you can just refer to tracks directly in your code at that stage
collection[id].tracks.push(value);
is how i wrote it, seems legit to me
Subh Samal
@subhsamal
yeah I could know problem in my code, was not able to use variable instead of literal. will try this @Athaman
V Arun Kumar
@arunvkumr
@ShashiDwivedi have you defined both noContact and propPresent? in the if condition of j loop gets false and both vars are not defined then, they are undefined variables, which if takes as false.
Subh Samal
@subhsamal
what if I have to use variable prop which stores track? Any idea? @Athaman
Keone Martin
@Athaman
yeah you can just use collection[id][prop].push(value);
at least i just rewrote mine and it worked.
Subh Samal
@subhsamal

function updateRecords(id, prop, value) {

if(value && prop !== "tracks"){ // if (value !== " ") is same as if (value)
collection[id][prop].push(value);
}

else if (value !== "" && prop == "tracks")
{
collection[id][prop].push(value);
}
else if (value === "")
{
delete collection[id][prop];

}

return collection;
}'''

CamperBot
@camperbot
:bulb: to format code use backticks! ``` more info
Subh Samal
@subhsamal
@Athaman I did it. Not able to get first condition corect.
Correct *
Keone Martin
@Athaman
it's not the pop line causing troubles
Markus Kiili
@Masd925
@subhsamal On the first test, set the property value instead of pushing. (you only push to tracks which is an array)