Lesson 2 – jQuery Basics

It is appropriate to study some jQuery basics before moving on to intermediate and advanced concepts. In fact, it is possible to use all the data types found in JavaScript and make use of its capabilities in jQuery. This is because jQuery is, in fact, nothing more than JavaScript.

The following lines explain the most basic jQuery concepts you will often come across as a full stack web developer.


Strings in JavaScript and jQuery can contain one or more items or it may be totally empty. It is immutable in JavaScript which means its values cannot be changed later on. We enclose a string in single or double quotation marks.

"This is a String"
'This is another String'
'This is "another type of" JavaScript String'


Just like strings, numbers are also immutable in JavaScript. They can be whole numbers or floats. The following are some examples of numbers.



Booleans can be either true or false in JavaScript and jQuery just like any other programming language. Both an empty string and zero default to false in JavaScript.

Here are some valid examples of Booleans in JavaScript.

     true      // true
      false     // false
      0         // false
      1         // true
      ""        // false
      "hello"   // true


JavaScript also supports objects like PHP and Python. You can use an object literal to create an object as shown in the following example.

     var emp = {
      name: "David",
      age: 15


Now, you can also employ the .notation method to add or change an object’s values.

     var emp = {
      name: "David",
      age: 15

    // Getting object properties
      emp.name  // ==> Zara
      emp.age   // ==> 10

    // Setting object properties
      emp.name = "Chris"  // 


It is also very easy to create arrays in JavaScript using array literals. An array can be empty or it can contain all kinds of data objects such as strings and numbers. Here is an example.

      var a = [];
      var b = [1, 2, 3, 4, 5];
      var c = ["one", "two", "three", "four"];


In the next lesson, we will study how to use Cascade Style Sheet (CSS) selectors in jQuery.