Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
CamperBot
@camperbot
no wiki entry for: with assignment pls
Yaroslav Newman
@YaroNew
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line

for ( var i=1; i> arr.lenght; i+5) {
  for (var j=0; j< arr[i].lenght; j++);
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr
Ken Haduch
@khaduch
@YaroNew - you have misspelled ".length" in two places... And you are not doing any multiplications - you should be multiplying the individual array elements (in your inner loop) times the product variable to get a value to return. Because the provided code does return product;
Yaroslav Newman
@YaroNew
@khaduch can you give an example
Ken Haduch
@khaduch
@YaroNew - a couple questions - do you have an explanation why your outer for loop has a variable that is initialized to 1, and then adds 5 as the iteration value? (There is a problem there, in my opinion.) Secondly - how would you access the elements of the two-dimensional array - there should be a lesson that describes and teaches that. "Access MultiDimensional Arrays With Indexes " is the lesson. The hint is that in your inner loop, you would need a statement that uses the syntax arr[ something1 ][ something2 ]; where the two different somethings are values that you generate to index into the multi-dimensional array.
Walid Ashri
@walidashri
@YaroNew
var arr=[[1,2],[3,4],[5,6,7]];
arr[0][1]= 2;
Yaroslav Newman
@YaroNew
@khaduch Yeap. Thanks for reminding.
CamperBot
@camperbot
yaronew sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1843 | @khaduch |http://www.freecodecamp.com/khaduch
Yaroslav Newman
@YaroNew
@khaduch so I need to turn all code in else\if statements
?
@khaduch

function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line


for ( var i=0; i < arr.length; i++) {
  for (var j=0; j< arr[i].length; j++);
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
here is how my code looks like now
Walid Ashri
@walidashri
@YaroNew inside 2nd for loop
product *=arr[i][j]
Yaroslav Newman
@YaroNew
@walidashri
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line


for ( var i=0; i < arr.length; i++) {
  for (var j=0; j< arr[i].length; j++);
  product *=arr[i][j];
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Walid Ashri
@walidashri
@YaroNew :+1:
Yaroslav Newman
@YaroNew
Doen't wokr
work
multiplyAll([[1],[2],[3]]); should return 6
multiplyAll([[1,2],[3,4],[5,6,7]]) should return 5040
multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]);) should return 54
it returns null
Yaroslav Newman
@YaroNew
@walidashri any ideas?
Walid Ashri
@walidashri
@YaroNew
for ( var i=0; i < arr.length; i++) {
  for (var j=0; j< arr[i].length; j++){
  product *=arr[i][j];
}
}
u are missing some {}
CamperBot
@camperbot
yaronew sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Yaroslav Newman
@YaroNew
@walidashri thx man!
CamperBot
@camperbot
:cookie: 495 | @walidashri |http://www.freecodecamp.com/walidashri
Ken Haduch
@khaduch
@YaroNew - just came back - in your post here: :point_up: October 27, 2016 10:20 PM it was really the ; at the end of the line for (var j=0; j< arr[i].length; j++); that was causing the problem. If you just removed that erroneous semicolon from the end of that for loop line, it would have worked fine, extra braces not necessary (but a good idea to have them for clarity.)
Yaroslav Newman
@YaroNew
@khaduch Thanks
CamperBot
@camperbot
yaronew sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:warning: yaronew already gave khaduch points
Walid Ashri
@walidashri
@khaduch thanks that's work, but how in earth the for loop knows its block end with out {}
CamperBot
@camperbot
walidashri sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1844 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
@walidashri - if you do not open a block of code with {} braces, then the next single line of code will be the body of the for loop. In this case, having the ; there was essentially setting up a "null" code statement to execute. If that wasn't there, then the single line that performed the multiplication would be the for loop's body.
@walidashri - but if you read coding guidelines, they'll tell you not to do that single-line block, and use braces to make it clear where the code body begins and ends.
Walid Ashri
@walidashri
@khaduch so
for(whatever)
do some// gonna be executed 
do some 2 // won't be excuted?
Rex Smith Jr.
@rsmith731
has anyone used Kendo Ui before?
sharkantropo
@sharkantropo
Hello, anyone could help me to figure out a current issue I have with an intermediate frontEnd challenge
Ken Haduch
@khaduch
@walidashri - yes, the first do some would be executed the number of times that the for loop dictates, and the do some 2 would be executed after that loop finished, most likely only one time (unless it was another for loop, for example.)
Walid Ashri
@walidashri
@khaduch :+1:
Ken Haduch
@khaduch
@sharkantropo - post your question and we'll try to help. Link to your code, explain what you are having an issue with, etc.
sharkantropo
@sharkantropo
@khaduch https://codepen.io/Sharkantropo/full/jrpbqX/ Alright, my Jquery code seems to work, but everytime I request to search wiki pages by putting the keyword and afterwards press enter, the page displays the results below but it autorefresh immediately and clean everything. ( nevermind the css and html, they are just there for staple)
Ken Haduch
@khaduch
@sharkantropo - are you using a <form for your page? Clicking the submit button on a form submits and reloads the page. You can put a method preventDefault() in your code to prevent the default action, which is to submit the page back to the server. There are other ways to do it, too - let me go check out your code page.
Ken Haduch
@khaduch

@sharkantropo - if you modify your code to add that line event.preventDefault(); in this place:

          if(event.which == 13)
               {
                  var searchTerm = $("#searchWord").val();
                  if (searchTerm !== "") {
                              ajaxAgent(searchTerm);
                            event.preventDefault();
                                  } 
                   else {

I believe that it will fix your problem.
(Pardon the sloppy indentation.)

sharkantropo
@sharkantropo
@khaduch No problem, I can understand it well enough. I'll add it right away.
@khaduch It worked, thanks !.
CamperBot
@camperbot
sharkantropo sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1845 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
@sharkantropo - great! You're welcome - good luck with the project!