Javascript Concepts: 1St Edition
()
About this ebook
The first objective of this book is to make it easy to write JavaScript solutions to a programming problem. Debugging and correcting your code quickly also becomes very easy at that point.
The second objective is to enable you to apply these concepts on another challenging language, like Java, C#.
Finally, I can promise you that by the time you finish reading this book and practice the exercises, you will become a master of JavaScript and ready to take on the next JavaScript challenge.
Mohammed Ashequr Rahman
Mohammed Ashequr Rahman is an adjunct professor at New York University’s (NYU) for over 20 years. During the last 20 years he has taught various courses at NYU including Java, Advanced Java, Java Web Services, JavaScript and Visual Basic. He has published a book titled “JavaScript Concepts” that is being used as a text book for JavaScript classes. He has recently started teaching at Hofstra University. Mohammed has a MS in Computer Science from NYU and has been working in IT field for the last 30 years. He also has an MBA with a Finance major from SUNY, Stony Brook. Mohammed is certified Project Management Professional and Oracle certified Java programmer.
Related to Javascript Concepts
Related ebooks
JavaScript for Gurus: Use JavaScript programming features, techniques and modules to solve everyday problems Rating: 0 out of 5 stars0 ratingsQuick JavaScript Learning In Just 3 Days: Fast-Track Learning Course Rating: 0 out of 5 stars0 ratingsMake Bootstrap Themes Rating: 0 out of 5 stars0 ratingsDecoding JavaScript: A Simple Guide for the Not-so-Simple JavaScript Concepts, Libraries, Tools, and Frameworks (English Edition) Rating: 0 out of 5 stars0 ratingsJavaScript: Tips and Tricks to Programming Code with Javascript Rating: 0 out of 5 stars0 ratingsJavaScript: Novice to Ninja Rating: 2 out of 5 stars2/5JavaScript: Best Practice Rating: 0 out of 5 stars0 ratingsMastering JavaScript: The Complete Guide to JavaScript Mastery Rating: 5 out of 5 stars5/5JavaScript: Beginner's Guide to Programming Code with JavaScript: JavaScript Computer Programming Rating: 0 out of 5 stars0 ratingsThe Joy of JavaScript Rating: 0 out of 5 stars0 ratingsJavaScript: Tips and Tricks to Programming Code with Javascript: JavaScript Computer Programming, #2 Rating: 0 out of 5 stars0 ratingsJavaScript Patterns JumpStart Guide (Clean up your JavaScript Code) Rating: 4 out of 5 stars4/5JavaScript Unlocked Rating: 5 out of 5 stars5/5JavaScript Projects for Kids Rating: 0 out of 5 stars0 ratingsJavaScript for the Business Developer Rating: 3 out of 5 stars3/5The Javascript Adventure Rating: 0 out of 5 stars0 ratingsNode.js: Novice to Ninja Rating: 0 out of 5 stars0 ratingsJavaScript: Beginner's Guide to Programming Code with JavaScript Rating: 5 out of 5 stars5/5Mastering JavaScript Rating: 4 out of 5 stars4/5Learning jQuery 3 - Fifth Edition Rating: 0 out of 5 stars0 ratingsComputer Programming: From Beginner to Badass—JavaScript, HTML, CSS, & SQL Rating: 3 out of 5 stars3/5Jump Start Vue.js Rating: 4 out of 5 stars4/5PHP & MySQL: Novice to Ninja Rating: 0 out of 5 stars0 ratingsUnderstanding JavaScript Promises Rating: 0 out of 5 stars0 ratingsJump Start PHP Environment: Master the World's Most Popular Language Rating: 0 out of 5 stars0 ratingsJavascript - 50 functions and tutorial Rating: 0 out of 5 stars0 ratingsVue.js: Tools & Skills Rating: 0 out of 5 stars0 ratings
Computers For You
Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5Network+ Study Guide & Practice Exams Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratingsThe ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 0 out of 5 stars0 ratings101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Ultimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5AP Computer Science Principles Premium, 2024: 6 Practice Tests + Comprehensive Review + Online Practice Rating: 0 out of 5 stars0 ratingsCompTIA Security+ Practice Questions Rating: 2 out of 5 stars2/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsChildhood Unplugged: Practical Advice to Get Kids Off Screens and Find Balance Rating: 0 out of 5 stars0 ratingsChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsPractical Lock Picking: A Physical Penetration Tester's Training Guide Rating: 5 out of 5 stars5/5Elon Musk Rating: 4 out of 5 stars4/5Dark Aeon: Transhumanism and the War Against Humanity Rating: 5 out of 5 stars5/5The Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Master Builder Roblox: The Essential Guide Rating: 4 out of 5 stars4/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5
Reviews for Javascript Concepts
0 ratings0 reviews
Book preview
Javascript Concepts - Mohammed Ashequr Rahman
© 2017 Mohammed Ashequr Rahman. All rights reserved.
No part of this book may be reproduced, stored in a retrieval system, or transmitted by any means without the written permission of the author.
Published by AuthorHouse 06/16/2017
ISBN: 978-1-5246-9445-6 (sc)
ISBN: 978-1-5246-9446-3 (e)
Any people depicted in stock imagery provided by Thinkstock are models,
and such images are being used for illustrative purposes only.
Certain stock imagery © Thinkstock.
Because of the dynamic nature of the Internet, any web addresses or links contained in this book may have changed since publication and may no longer be valid. The views expressed in this work are solely those of the author and do not necessarily reflect the views of the publisher, and the publisher hereby disclaims any responsibility for them.
18449.pngContents
Section A – JavaScript Language
Chapter 1
Data Types in JavaScript
JavaScript and Browser Console
Variable Naming Convention
Arithmetic Operations
Commenting your code
Conditional Operation
Truthy and Falsy in JavaScript
Undefined on the Console
Embedding JavaScript in an HTML file
JavaScript Debugging
Loops
Chapter 2
What is a Function?
Default values of parameters
Invalid parameters
Converting a no parameter function into an unlimited parameter function
Variable Scope in JavaScript – Global vs. Local Variables
Global Disaster in JavaScript
Parameter Passing, Pass By Value
Function as Variable
Chapter 3
Arrays
For-in loop
Arrays Functions (methods)
Function as Parameter and forEach loop
Function as Parameter and Number Sorting In Array
What is object?
Object and []
Object and for-in loop
Methods
Object containing Object
Constructor
Methods on Prototype of Constructor
instanceof Operator
Parameter Passing, Pass By Reference
Array as Object
Function as Object:
String, Number, Boolean Object
Regular Expression
Section B – JavaScript and HTML
Chapter 4
What is HTML?
What is HTTP?
Fiddler Tool
Tomcat
Abyss
What is DOM?
HTML DOM and JavaScript
Modifying DOM impacts the HTML page
Chapter 5
Getting to Elements in DOM using JavaScript
HTML tags –
Programmatic
Checkbox and Validation
Radio Button and Validation
Dropdown and Validation
List and Validation
TextArea
Chapter 6
Getting to know Events
Event Handling Options
Cancelling Event – preventDefault()
DOMContentLoaded Event
Event Bubbling
this vs Event.target
Event Capturing
Canceling the Bubbling
Use of Bubbling
Creating Tabs on a page
Chapter 7
XML Parsing and Serialization
JSON (JavaScript Object Notation)
AJAX (Asynchronous JavaScript and XML)
AJAX and XML
AJAX and JSON
Chapter 8
Slideshow
Appending Nodes in DOM
Inserting Before
Deletion
Dynamic Delete Button
Dynamic Table
Dynamic Photo Gallery
Section C - JQuery
Chapter 9
What is JQuery?
Why JQuery?
How to get JQuery?
How to include any JavaScript file in your html?
How do you include JQuery JavaScript file in your html?
What function in JQuery’s .js file can I call?
How to use JQuery?
JQuery Selectors
JQuery Append
JQuery inserting innerHTML
JQuery adding and removing event handler
JQuery AJAX
$.each() function in JQuery
Preface
This book is about understanding of the concepts of JavaScript as a language and then applying these concepts to develop dynamic web pages using JavaScript.
The first objective of this this book is to make it easy to write JavaScript solutions to a programming problem. Debugging and correcting your code quickly becomes also very easy at that point.
The second objective is to enable you to apply these concepts on another challenging language like Java, C#.
Finally, I can promise you that by the time you finish reading this book and practice the exercises, you will become a master of JavaScript and ready to take on the next JavaScript challenge.
About the Author
Mohammed Ashequr Rahman is an adjunct professor at New York University’s (NYU) for over 20 years. During the last 20 years he has taught various courses at NYU including JavaScript, Java and Visual Basic.
He has recently started teaching JavaScript at Hofstra University.
Mohammed has a MS in Computer Science from NYU and has been working in IT field for the last 29 years.
He is also finishing up his MBA with a Finance major at SUNY, Stony Brook.
Mohammed is certified PMP and Oracle certified Java programmer.
Introduction
This book is broken down into 3 fundamental sections. In the first section, we will learn JavaScript as a language. In the second section, we will learn how to use JavaScript with the web pages to generate dynamic content. In the third section, we will learn how to use JQuery, the most popular JavaScript libraries.
You can download all the examples in the book from the following url:
https://drive.google.com/file/d/0BzE52XmaCfzuTjBNd1RQNTYzd1k/view?usp=sharing
Section A – JavaScript Language
Chapter 1
Why JavaScript?
JavaScript is the language of the web. Even a modest web application has tons of JavaScript in it.
JavaScript is simple, easy to learn. It lets you make tons of mistakes and easily recover from them. It’s awesome!
JavaScript Interpreter
We generally write a computer program using a high-level language like JavaScript. A high-level language is one which is understandable by us humans. It contains words and phrases from the English language. But a computer does not understand English. It only understands program written in 0’s and 1’s in binary, called the machine code. So, a program written in English like high level language needs to be translated to machine code.
A program written in high-level language is called a source code. We need to convert the source code into machine code and this is accomplished by either a) compilers or b) interpreters.
Hence, a compiler or an interpreter is something that converts source code written in high-level language into machine code understood by the computer.
Language like C, C++, and Pascal uses compiler to do the job. A compiler converts all the source code to machine code at once and hides the source code as intellectual property of the company. Hence users never get to see the source code. A compiler is like a person translating your written lecture from English to German.
JavaScript, on the other hand, uses Interpreter instead. An Interpreter converts source code to machine code one line at a time. An interpreter is like a person who translates your verbal lecture from English to German as you speak.
One side effect of using interpreter is that the source code is open to public. Your browser downloads the JavaScript source code and runs as Interpreter. Therefore, JavaScript source code is wide open to public. We can learn a lot from JavaScript written by other people.
JavaScript Editor
Download Sublime Text
latest version. This is our JavaScript editor for now. We can write JavaScript Code here and then run them on Browser Console.
Browsers
Browser 1) Get Chrome Canary. This version of Chrome is updated almost daily. However, regular Chrome would work just fine. Click on the vertical bar with dots on the top right, select More Tools