Decoding JavaScript
US$ 19.95
The publisher has enabled DRM protection, which means that you need to use the BookFusion iOS, Android or Web app to read this eBook. This eBook cannot be used outside of the BookFusion platform.
Description
Contents
Reviews
Language
English
ISBN
9789390684816
Cover Page
Title Page
Copyright Page
Dedication Page
About the Author
About the Reviewer
Acknowledgement
Preface
How to use this book?
Errata
Table of Contents
1. Introduction to JavaScript
Structure
Objective
Getting started with JavaScript
The Inception of JavaScript
What exactly is JavaScript?
Setting up the system
How to add JavaScript to your web page?
Comments in JavaScript
Datatypes and operators in JavaScript
Datatypes and variables in JavaScript
Create a variable (declaration)
Give a value to the variable (initialization)
Data types in JavaScript
Operators in JavaScript
Conditionals and looping in JavaScript
Conditional coding in JavaScript
If…else conditional statement
Switch conditional statement
Looping in JavaScript
The Journey of the Web Page
JavaScript and the DOM
Conclusion
Points to remember
Multiple choice questions
Answers
2. The Developer’s Tools
Structure
Objective
Event Listeners in JavaScript
Introduction to the Developer Tools
Opening the DevTools
Panels of DevTools
JavaScript and the DevTools
Console Panel
Console Area
Filter Area
Header of the console
Sources Panel
Conclusion
Points to remember
Multiple choice questions
Answers
3. Functions
Structure
Objective
Exploring Functions
Syntax
Functions returning values
Types of functions
JavaScript Scope
JavaScript Closure
Conclusion
Points to remember
Multiple choice questions
Answers
4. Arrays
Structure
Objective
Introducing Arrays
Using Arrays
Creating an array
Declaring an array
Initializing an array
Access the elements of an array
Change the elements of an array
Array Properties and Methods
length
Accessing first and last elements of an array
Looping through an array
push and pop
delete
shift and unshift
splice and slice
Splicing an array
Slicing an array
concat
toString
join
Conclusion
Points to remember
Multiple choice questions
Answers
5. Objects
Structure
Objective
Introducing Objects
Using objects
Object definition
An object literal
JavaScript keyword new
Constructor
Object properties and methods
Object properties
Accessing Object Properties
Dot notation
Square bracket notation
Changing object properties
Displaying object properties
Display object properties by name
Using Object.values()
Object methods
The 'this' keyword
Objects versus Primitive values
Copy by value
Copy by reference
Object Constructors
Object Prototypes
Conclusion
Points to remember
Multiple choice questions
Answers
6. ES6
Structure
Objective
Introduction to ES6
JavaScript hoisting
New ES6 Syntax
Let and const
let
const
Bind, call, and apply
bind
call
apply
Advanced operators
Ternary operator
Rest Parameters
Spread operators
Template literals
Arrow functions
Shorter syntax
The this keyword in ES6 functions
New array methods – map, filter, and reduce
map()
filter()
reduce()
Array and object destructuring
ES6 Modules
Conclusion
Points to remember
Multiple choice questions
Answers
7. Classes
Structure
Objective
Understanding classes
When to use functions and when to use classes?
Are classes hoisted?
Classes and methods
Inheritance
Getters and Setters
Conclusion
Points to remember
Multiple choice questions
Answers
8. Callbacks and Promises
Structure
Objective
Asynchronous JavaScript
When to use asynchronous JavaScript
Callback Functions
How can callback functions help in asynchronous JavaScript
Callback Hell
Promises
Chaining Promises
async and await
async
await
Conclusion
Points to remember
Multiple choice questions
Answers
9. AJAX and Interacting with Servers
Structure
Objective
JSON – The Web’s favorite file format
Structure of JSON
Working with JSON
JSON.stringify()
JSON.parse()
Exchanging data
AJAX
HTTP
HTTP Methods
GET
POST
PUT
PATCH
DELETE
HEAD
OPTIONS
HTTP status messages
1xx: Information
2xx: Successful
3xx: Redirection
4xx: Client Error
5xx: Client Error
The Process of AJAX
HTTP Headers
setRequestHeader()
Conclusion
Points to remember
Multiple choice questions
Answers
10. Developing a Live Application!
Structure
Objective
The live application – Nom Nom!
Software development lifecycle
The Idea
The Flow
The Design
Laying the foundations
The folder structures
Creating the HTML files
Index.html
Recipe-detail.html
The Initial Styling
Connecting to the server
Updating the Home page with the server response
Moving to the Recipe Detail page
Updating the Recipe Details page
Fetching the detailed recipe
Fetching the id passed from the home page
Sending a request to the server with the id
Create the HTML elements inside the Recipe Details page
Adding the link back to the home page
System testing
Adding a text for loading
Error Handling
Conclusion
Points to remember
Multiple choice questions
Answers
11. Storing Data in Browsers
Structure
Objective
Introduction to Web Storage
Cookies
Usage
Disadvantage
Structure
Creating cookie with JavaScript
Reading cookies with JavaScript
Deleting cookies with JavaScript
Security
Third-party cookies
Web storage APIs
Session Storage
Setting the value inside session storage
Fetching the value from session storage
Removing a value from session storage
Local Storage
Setting the value inside local storage
Fetching the value from local storage
Removing a value from local storage
IndexedDB API
Features of IndexedDB API
IndexedDB terms
IndexedDB process
Check if IndexedDB is supported
Open the database
Add data
View data
Service workers
Caches
Testing on Console
Conclusion
Points to remember
Multiple choice questions
Answers
12. Debugging and Error Handling
Structure
Objective
Errors
Types of Errors
EvalError
RangeError
ReferenceError
SyntaxError
TypeError
URIError
Introduction to Debugging
The console.log() method
Debugging with breakpoints
The debugger keyword
Try, catch, and finally
Conclusion
Points to remember
Multiple choice questions
Answers
13. Testing and Test Frameworks
Structure
Objective
Introduction to testing
Test-Driven Development
Behavior-Driven Development
Types of testing
Unit tests
Integration tests
End-to-end tests
Ideal testing structure
Testing Frameworks
jsdom
Karma
Chai
Cucumber
Jest
Jasmine
Mocha
Selenium
Jest
Install package managers
Initialize a new project
Install Jest using npm or yarn
Create a function for testing
Create the test file
Add/Modify package.json
Running the test
Conclusion
Points to remember
Multiple choice questions
Answers
14. Regular Expressions
Structure
Objective
Introduction to Regular Expressions
Creating a Regular Expression
Regular Expression Literal
JavaScript RegExp Object
Writing Regular Expressions pattern
Using simple patterns
Using groups and ranges
x|y
[xyz] or [x-z]
[^xyz] or [^x-z]
Using special characters
Assertions
^
$
\b
x(?=y)
(?<=y)x
Character Classes
Quantifiers
Advanced searching with flags
g
i
m
JavaScript methods for Regular Expressions
exec()
test()
matchAll()
replace()
replaceAll()
Practical example of Regular Expressions
Conclusion
Points to remember
Multiple choice questions
Answers
15. Life After ES6
Structure
Objective
Introduction to ECMAScript
The Origin
The Browser War
The Standardization
So, is JavaScript the same as ECMAScript?
The Versions
ES6 – The new future!
ES7
Array.prototype.includes()
Exponentiation Operator
ES8
Object.values()
Object.entries()
String padding
Async functions (async and await)
Trailing commas in functions
Object.getOwnPropertyDescriptors()
ES9
Rest/Spread properties
Regular Expression – Lookahead and Lookbehind
Asynchronous Iterations
Finally in promises
ES10
Array.flat()
Array.flatMap()
Object.fromEntries()
String.trimStart() and String.trimEnd()
Function.toString()
Optional catch binding
ES11
Optional chaining operator
Private fields
Dynamic Imports
Import meta
New datatype - bigint
globalThis
matchAll
Promise.allSettled()
ES.Next
Conclusion
Points to remember
Multiple choice questions
Answers
16. Tips and Tricks
Structure
Objective
Best practices
Naming
Naming conventions
White Spaces
Rule of 80
Declarations at the top of the scope
Consistency with quotes
Comment your code often
Tips and Tricks
Filter unique values in an array
Object destructuring
Get last items of an array
Set dynamic keys of an object
Truncate an array
Improving conditionals
Setting default values
Every and some
Conclusion
Points to remember
Index
The book hasn't received reviews yet.