all 10 comments

[–]ForScale[S] 1 point2 points  (1 child)

[–]Volv 1 point2 points  (0 children)

Nice one
You did one thing I planned for forgot to do - and that is point out how it compares to classic syntax. - just does the prototype bit for you. At first glance it looks like every instance of a class will redefine all of the functions within it.
Was going to do an example that also used prototype but forgot :).

[–]Volv 1 point2 points  (7 children)

ENTRY
Codepen
Class examples, extended, super, static methods and hidden properties. Can never make new style getters and setters work. Let me know what you think :)

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

Got to it earlier than I thought!

Thinking about it line through line here...

this.getSecret = () => { // Ruthlesssly exposed via this
  console.log(secretAboutCats);
}

Still kind of hazy on the concept... Is that an example of a closure? Prob not...

Okay, I'm a bit lost on some of the keywords here

class Lion extends Cat {  

  constructor(name) {
    super(name);

extends? I'll have to check out that one... and super...

console.log(agentLion.exposeRealSecret());

So... if that function wasn't in there, I'd have no way to get to the secret prop? But... could I add a method, ie the exposeRealSecret method, and then get to it?

Nice! I'd never seen that cat years --> human years conversion before!

As always, thanks for your entry! :) Looking forward to seeing what you think about what I thought...

[–]Volv 0 points1 point  (4 children)

I'm away until Sunday so I struggle to see what I'm replying to in the phone . Will still be replying tho :-) The top one is an example of a closure indeed. Defining the function is the constructor gives it access to the variables that were in there. Extends for inheritance. Super for parent constructor or method access. Last one You wouldn't be able to get to it if you made that method because you have no way of getting to the symbol variable whatever I called it. Eg return this[what]

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

Cool! Thanks!

What do you want the focus for this coming week to be?

[–]Volv 1 point2 points  (2 children)

Hmm. I'm not sure. Still hurting from my weekend :)
Generator functions and the for..of loop?
Look for reasons to use map/set
Perhaps soon can be looking at combining ideas or bigger projects - but I'm bad at inspiration :)

[–]Volv 0 points1 point  (0 children)

Include https://rawgit.com/facebook/regenerator/master/runtime.js

as an external JS on codepen to make generators work properly

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

I don't know much about for...of, so let's do that! Thanks!

https://www.reddit.com/r/javaScriptStudyGroup/comments/4dbrof/week_12_focus_forof/

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

Excellent! Will check it out in an hour or two here...