JavaScript

jQuery quick start

Before learning jQuery, you should learn HTML, CSS, JavaScript, and learn how to debug JavaScript. You should also be familiar with JSON. Knowing XML will also be helpful.

jQuery is a free and open source JavaScript library. It simplifies common web tasks such as state initialization or updating elements and makes it easy to make AJAX calls, manipulate content, and create animations. It also does the dirty work of dealing with cross-browser compatibility issues. jQuery's syntax is much simpler and concise than the syntax of vanilla JavaScript.

Setting script src dynamically

Suppose you need to call some JavaScript code on your page such as:

  <script src"somecode.js"></script>

However, the somecode.js is different based on other parameters on your page. So you would need to pass a variable rather than the static string to the src. If you just replace somecode.js, with a variable name, you code will not be called.

The following example shows how you can manipulate DOM to define src so that your code runs.

Brackets /bin/sh: node: command not found

Problem

JavaScript code not running on Brackets.

Error Message

/bin/sh: node: command not found
Program exited with status code of 127

Root Cause

Brackets cannot find node binary file.

Solution

Open terminal and type the following commands and note the addressed returned:

which node
which npm

Click on Node.js > Configuration... from the main menu. Then copy/paste the paths to binary files you retrieved in the command line. For example:

What is a Full Stack

Full-stack is a complete JavaScript solution which involves JavaScript on both client-side and server-side. There are many full-stack solutions but MEAN stack is the most widely used solution. There are many different variations of the full-stack but it essentially involves: