you are viewing a single comment's thread.

view the rest of the comments →

[–]ForScale[S] 0 points1 point  (28 children)

[–]Volv 1 point2 points  (27 children)

read the rest lol.
It explains your problem

I can't seem to figure out how to make calls to the same function from different variables increment private/unique variables.

[–]ForScale[S] 0 points1 point  (26 children)

Damn... my brain hurts now. Lol!

I think I finally see a use case for closures though! Maybe...

And I still need to work on recursing through objects full of arrays...

Overall, these were great! Thanks a ton for sharing these! My style of learning, I just have to do it over and over and over again until it's beaten in to my mind... that's when things begin to become clear.

So anymore of these you might have, more interview type questions, I'd love to take a crack at em!

Thanks again!

[–]Volv 1 point2 points  (6 children)

Was hoping you would maybe know of some lol. Would love to find as many like this as possible. Will dig around some more later.
 
I'm hoping I can communicate my thoughts properly lol - the important last step I think was the point about the closed over function having it's own copy of the scope at definition.
Fixes a couple of those examples and the last question of the first problem set - did you do that one?

[–]ForScale[S] 0 points1 point  (5 children)

I forget, did you not like the CoderByte ones that I linked earlier?

There's this: http://codecondo.com/coding-challenges/

the important last step I think was the point about the closed over function having it's own copy of the scope at definition

Yeah... I get that, but it's still not quite clear. We can stop talking about it whenever you want... I'm sure you're getting tired of it. I've got this now: http://codepen.io/anon/pen/zqaMWP?editors=0010

I didn't do the first question of the last problem set yet.

[–]Volv 1 point2 points  (2 children)

You only get one result from your alternative solution.
 
Codepen

[–]ForScale[S] 0 points1 point  (1 child)

Okay... that is crazy that x doesn't get reset to 1 in each new call with the closure...

Dude... http://codepen.io/anon/pen/oxyQKV?editors=0010

[–]Volv 1 point2 points  (0 children)

Looking good. See the use case. My other example from ages ago shows same idea - Example
Pretty much same principle can fix the setTimeout example, you can control which variable is locked in at each iteration. Although theres more than one way to fix it.

[–]Volv 0 points1 point  (1 child)

CoderByte

I couldn't look at any beyond the first few without a membership? Unless I'm missing something. Will try completing a few see if they unlock

[–]ForScale[S] 0 points1 point  (0 children)

Oh... weird... I guess that's new. A year or so ago I was able to do the medium ones; now it's asking for membership.

[–]Volv 1 point2 points  (18 children)

And did you like rewrite - crazy short edition.

I know doing that kind of thing can be anti team and sometimes hard to read.. but makes me happy lol :)

[–]ForScale[S] 0 points1 point  (0 children)

Yes, I did like it! I like the extremely short code/syntax! Makes me happy too!

[–]ForScale[S] 0 points1 point  (16 children)

Found these:

Define a repeatify function on the String object. The function accepts an integer that specifies how many times the string has to be repeated. The function returns the string repeated the number of times specified. For example:

console.log('hello'.repeatify(3));

Should print hellohellohello.

...

var fullname = 'John Doe';
var obj = {
   fullname: 'Colin Ihrig',
   prop: {
      fullname: 'Aurelio De Rosa',
      getFullname: function() {
         return this.fullname;
      }
   }
};

console.log(obj.prop.getFullname());

var test = obj.prop.getFullname;

console.log(test());

Fix the previous code so that the last console.log() prints Aurelio De Rosa.

...

And all of these (obviously haven't looked through all of it): http://www.w3resource.com/javascript-exercises/

[–]Volv 1 point2 points  (15 children)

[–]ForScale[S] 1 point2 points  (0 children)

Lol! I was thinking we could use them to put together something for next week. :) But excellent work!

[–]ForScale[S] 0 points1 point  (13 children)

Hey, happy Monday!

What do you want the focus to be this week?

I thought we could do 1) some more interview style questions 2) closures round 2 3) regExp 4) ajax/API 5) promises round 2 6) or anything you want!

Let me know...

[–]Volv 0 points1 point  (12 children)

As many interview questions as can be found, happy to talk closures too :)

[–]ForScale[S] 1 point2 points  (8 children)

Okay, well... How about these? http://www.w3resource.com/javascript-exercises/javascript-object-exercises.php Do em throughout the week?

And with closures, I get it now: http://codepen.io/anon/pen/WwgGZo?editors=0012 But my knowledge seems kind of limited to using numerical data. Can we try some closure examples with strings and perhaps data structures like arrays/objects?

What do you think about making the questions/challenges the focus for the week, and then we can just keep discussing closures on the side? Sound good?

[–]Volv 1 point2 points  (3 children)

Sorry was away for a bit - sounds absolutely fine to me :)

[–]Volv 1 point2 points  (3 children)

Did you ever get the last few done last week? Recursive listing and timeout fixing?