Jump to content

Binary Tree

Members
  • Posts

    4
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Binary Tree's Achievements

Lepton

Lepton (1/13)

0

Reputation

  1. A function is a way to encapsulate a block of code. Say you have to do some computation multiple times. Instead of repeating the code that does the computation multiple times, you enclose that code in a function, and call the function every time you need to do the computation. A big advantage of this is that if you need to modify the computation code, you only need to do that in one place. Another important use for functions is to decompose other long functions. Say you have a function where you first do A, then B, and then C. It is a good idea to separate the code that does A into a function, the code that does B into another function, and the code that does C into yet another function. Then you have your function just call those three functions. This makes it much easier to read and maintain you code.
  2. If you google "resources to learn programming", you will find many articles enumerating dozens of resources to get started.
  3. If you notice yourself trying to do too much in a single function, break it down into helper functions, and have your function just call those helper functions. Give the helper functions descriptive names, such that when you read the main function, you know exactly what is happening, without looking at the implementation of the helper functions.
  4. This is a good place to start learning JavaScript: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps If you're interested in documentation, here's a complete reference documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.