Array and object example

Lesson Details:
October 21, 2020


I: Introduction

the use of computers is not new. it has been in existence for more than 60 years. even before that, the abacus was used to perform simple arithmetic operations. computers are used in diverse ways. they can be used to design a building, write a book, play games, etc. web development is one area where computers are used extensively.

Web Development Course

Web development is the process of developing websites or web applications using several software tools and programming languages. Web development involves writing code using HTML, CSS, JavaScript, PHP, etc. Web development can be done using popular platforms like WordPress, jQuery, Bootstrap, etc. Most top companies like Google, Facebook, Apple employ web developers to create websites for their services.

II: Body

A: Array and object example

The best way to learn something is by example. So, let us consider an example program to understand how web development works. The following example uses array and objects to create an address book. We will learn about arrays later in this article. For now, consider an array as an ordered group of values like names of people. Similarly, an object is a collection of properties (name, age, email) and functions (sayHello(), sayGoodbye()) that work with the property values. The following example creates an array called bookmarks with 10 elements. Each element in the array contains the name of a website that the user has saved in his browser bookmark bar. The first element is index 0. The last element is index 9. Here are the properties of the bookmarks array.

Now, let us create an object called user details to store information about a user in the address book application. It contains two properties email and age . It also contains two functions sayHello() and sayGoodbye() . When you click on each element in the array bookmarks , userDetails says hello or goodbye depending on whether it is index 0 or index 1 respectively. The output in the image below shows how the program runs when you click on each element in the bookmarks array. It also displays the value returned by the sayHello() function when you click on the index 0 element in the bookmarks array.

B: Learn how to use jQuery

jQuery is a powerful Javascript library for creating interactive web pages. It helps you to simplify your coding efforts when writing functionalities for your webpage. jQuery makes use of CSS selectors to select elements from html page and then apply functions on them. You can find out more about getting started with jQuery here: https://www.w3schools.com/jquery/default.asp.

C: Learn HTML and CSS basics

HTML is HyperText Markup Language and it is the core markup language for creating websites and web applications. It defines semantic structure for your webpage and then CSS takes care of presentation of that content on your page. Learn more about HTML and CSS at: https://www.w3schools.com/html/html_intro_tag_attributes.asp and https://www.w3schools.com/css/default.asp respectively.

III: Conclusion

loader
Course content