Coder Social home page Coder Social logo

Comments (5)

bgveenstra avatar bgveenstra commented on September 14, 2024 1

I would prefer to split out the callback function definitions entirely for learning purposes. I have 4 or 5 students who aren't confidently able to distinguish a function definition from a function call as is, so I think it'd be cool to keep em separated.

Afaik we haven't shown them anonymous functions (edit: not even accidentally). Both classes have seen

var numbers = [1, 4, 9];
function doubler(num) {
  return num * 2;
}

var doubles = numbers.map(doubler);

and

var numbers = [1, 4, 9];

var doubles = numbers.map(function doubler(num) {
  return num * 2;
});

from shared_modules.

nathanallen avatar nathanallen commented on September 14, 2024

As a compromise, considered named callback-functions. Somehow it always feels like it makes more sense to them since it just looks like a normal function. Whereas both anonymous functions and function references look weird.

It's the missing, intermediate step:

numbers.map(function doubler(num) {
  return num * 2;
});

from shared_modules.

tgaff avatar tgaff commented on September 14, 2024

I think you showed them both today(20160316), right @bgveenstra ?

Thanks for the responses both of you. šŸ”

from shared_modules.

bgveenstra avatar bgveenstra commented on September 14, 2024

@tgaff No anonymous functions today. Just the named inline callback definition and the separate named callback definition.

from shared_modules.

tgaff avatar tgaff commented on September 14, 2024

Great! That's what I meant! I think Will is going to repeat that in the review tomorrow too.

from shared_modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.