GithubHelp home page GithubHelp logo

markdenardo / js-advanced-functions-introduction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-curriculum/js-advanced-functions-introduction

0.0 1.0 0.0 21 KB

Introduction to JavaScript advanced function usage: this, call, bind, apply, etc.

License: Other

js-advanced-functions-introduction's Introduction

JavaScript Advanced Functions: Introduction

On Character and Programming Languages

As you learn more more about other programming languages, you'll come to realize that they each have a point of view — themes and patterns that may be unique to them that will become more obvious as you become familiar with them. Consider some of your favorite authors or artists; many of them likely have a certain style that gives their work away without it being explicitly stated:

  • For example, many Quentin Tarantino movies involve shootouts and pop culture references from bygone years
  • Maria Callas' bel canto wedding of emotional tension with vocal interpretation
  • Dickens novels usually feature noble, but poor, people showing virtue against a cruel world
  • Rothko paintings are very large in scope and seem designed to dominate your emotions

Like these creators, JavaScript has a fundamental point of view:

JavaScript loves functions.

JavaScript makes this love clear from our first encounter with functions. It makes functions first-class data. Functions, that is to say, "frozen" work, can be passed around like "primitive" data (Strings or Integers, etc.). JavaScript passes around its functions, shoves them to Arrays, makes them accessible via a key in an Object, and more. Few other programming languages share this point of view.

On Personal Character and Programming Languages

Who learns another language learns another mind — Charlemagne

Because of JavaScript's uncommon love for functions, developers sometimes get stymied by difficult bugs and they blame the language for it. This is unfortunate. Don't fall victim to this pattern of behavior with JavaScript (or, with much of anything in life): seek to understand its point of view and appreciate the growth that search provides.

Approach JavaScript with curiosity and appreciation and JavaScript will show you a whole new way of thinking about the world.

Those who do understand JavaScript's point of view are able to:

  • write compact code that works in a wide variety of situations
  • grasp the design approaches of new JavaScript frameworks (React, Vue, Angular)
  • debug subtle, yet tricky bugs

These are all abilities worth having! So, let's get to know the mind of JavaScript by learning some of the amazingly cool things we can do with functions.

The Road Ahead

First, we'll start off by doing a quick recap of the basic use and creation of functions. Make sure that you're comfortable with these declarations and concepts as they're going to be the essential tools you need to understand JavaScript's love of the function.

Then we'll take a slight tangent: we're going to explore JavaScript's collection-processing methods. These are methods with names like map, reduce, and filter. If you come from a Ruby background you'll recognize these as the Enumerable methods and will be comfortable with the idea of what they do and how they work. But, importantly, these methods, in JavaScript work by doing some really surprising stuff with functions. So while we want you to know these methods for their own sake — they'll make doing data processing much easier — we also want you to see how these methods show JavaScript's love of passing functions about.

With a good grip of functions, we'll tackle one of the biggest mysteries of learning JavaScript, the keyword this and its associated methods of call, bind, and apply. These methods consistently baffle new JavaScript developers and yet they are absolutely essential to working with JavaScript frameworks like React and Angular and writing Object- Oriented JavaScript. Many developers never really appreciate what's happening here and are forever searching the internet or avoiding code that makes them uncomfortable. We won't let that happen to you. Oh yeah, interviewers love to ask questions in this area, so we want to make sure you're well-prepared!

After that, you might fall in love with functions as much as JavaScript has. You're going to see the wisdom of some of JavaScript's choices and are going to be a more-thoughtful, more-empathetic, and more robust developer.

js-advanced-functions-introduction's People

Contributors

drakeltheryuujin avatar

Watchers

James Cloos avatar

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.