JavaScript: Optimizing Native JavaScript: Designing, Programming, and Debugging Native JavaScript Applications
JavaScript has become the most popular programming language in the world. It has attained that position by being easy to use and powerful in its capabilities. It wasn’t always that way but today it can be used to build virtually any application you desire. With the addition of HTML5 and CSS3, it allows for wonderfully animated and powerful web sites and applications without having to use other technologies such as Adobe Flash. JavaScript has also become much more standardized across the multiple browsers in use today. With the recent proliferation of libraries and frameworks that many developers use, the focus has shifted towards these new tools, but they still rely on native JavaScript. And these libraries and frameworks can greatly increase the size of your code as well as slowing down performance. This book covers best practices for coding in straight JavaScript as well as pointing out many areas for optimization. The goal is to help programmers produce smaller and faster JavaScript applications. Even programmers using frameworks and libraries can benefit from understanding the performance trade-offs they make when using those tools.
1125815146
JavaScript: Optimizing Native JavaScript: Designing, Programming, and Debugging Native JavaScript Applications
JavaScript has become the most popular programming language in the world. It has attained that position by being easy to use and powerful in its capabilities. It wasn’t always that way but today it can be used to build virtually any application you desire. With the addition of HTML5 and CSS3, it allows for wonderfully animated and powerful web sites and applications without having to use other technologies such as Adobe Flash. JavaScript has also become much more standardized across the multiple browsers in use today. With the recent proliferation of libraries and frameworks that many developers use, the focus has shifted towards these new tools, but they still rely on native JavaScript. And these libraries and frameworks can greatly increase the size of your code as well as slowing down performance. This book covers best practices for coding in straight JavaScript as well as pointing out many areas for optimization. The goal is to help programmers produce smaller and faster JavaScript applications. Even programmers using frameworks and libraries can benefit from understanding the performance trade-offs they make when using those tools.
19.95 In Stock
JavaScript: Optimizing Native JavaScript: Designing, Programming, and Debugging Native JavaScript Applications

JavaScript: Optimizing Native JavaScript: Designing, Programming, and Debugging Native JavaScript Applications

by Robert C. Etheredge
JavaScript: Optimizing Native JavaScript: Designing, Programming, and Debugging Native JavaScript Applications

JavaScript: Optimizing Native JavaScript: Designing, Programming, and Debugging Native JavaScript Applications

by Robert C. Etheredge

Paperback

$19.95 
  • SHIP THIS ITEM
    In stock. Ships in 1-2 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

JavaScript has become the most popular programming language in the world. It has attained that position by being easy to use and powerful in its capabilities. It wasn’t always that way but today it can be used to build virtually any application you desire. With the addition of HTML5 and CSS3, it allows for wonderfully animated and powerful web sites and applications without having to use other technologies such as Adobe Flash. JavaScript has also become much more standardized across the multiple browsers in use today. With the recent proliferation of libraries and frameworks that many developers use, the focus has shifted towards these new tools, but they still rely on native JavaScript. And these libraries and frameworks can greatly increase the size of your code as well as slowing down performance. This book covers best practices for coding in straight JavaScript as well as pointing out many areas for optimization. The goal is to help programmers produce smaller and faster JavaScript applications. Even programmers using frameworks and libraries can benefit from understanding the performance trade-offs they make when using those tools.

Product Details

ISBN-13: 9780986307638
Publisher: MiraVista Press
Publication date: 05/08/2017
Pages: 180
Product dimensions: 7.40(w) x 9.40(h) x 0.50(d)

About the Author

Robert C. Etheredge is a programmer and designer of JavaScript/HTML interfaces to process big data for health related applications. He has been programming for more than 30 years and has designed or programmed more than 20 software products and spent 16 years programming set top boxes and mobile devices using JavaScript and HTML. He is the author of The American Challenge and the editor of The Camper’s Companion, The Camper’s Digital Companion, and The Military Companion. He lives in Orinda, California.

Table of Contents

Introduction

1 Basic Principles

Principles 9

2 JavaScript Formatting

Strict mode 13

Comments 14

Punctuation 16

Lines and spacing 18

Variable and function names 19

Global namespace 20

The var declaration statement 23

Code compilers and mini tiers 25

3 JavaScript

JavaScript versions 29

Performance 29

Variable types 30

Using the typeof 'command 32

Testing for 'falsey' values 34

Hoisting 37

Converting strings to numbers 38

Converting numbers to strings 40

Loops 42

Concatenating strings 45

Regular expressions 45

Should I switch to using switch? 46

SetTimeout is your friend 47

Reduce the creation of garbage 49

Sparse arrays 52

Handling typeahead 54

Try/Catch 55

Using fixed arrays 56

Dangers of premature optimization 58

Infinite scrolling on non-touch screens 58

4 Objects

Creating objects 61

Declaring methods for objects 63

Deleting unused object references 64

Assigning object properties 66

Getters and setters 67

Using this and that with objects 68

Enumerating properties of an object 69

5 HTML

How to add HTML elements to your application 71

Getting to your first screen faster 72

Ways to minimize your impact on the DOM 73

Difference between visibility, opacity, and display 74

Finding HTML elements 75

Binding events 77

InnerText vs. innerHTML 78

Getting images to display faster 80

6 CSS Techniques

Including CSS in your application 83

Position property 83

Display property 84

Setting style properties using JavaScript 84

CSS selectors 86

CSS box model 89

Making text selectable 90

Centering elements 91

Other CSS properties I often forget 92

7 Event Handling

Setting event handlers 93

Event propagation 94

Event delegation using event bubbling 97

Setting handlers for mousemove events 98

Removing event handlers 98

Handling dblClick events 99

Getting the event properties you want 99

8 Handling Data Efficiently

Managing server requests 103

Managing memory and bandwidth 104

Managing the DOM 105

Improving performance 106

Real life examples 107

Scrolling, sorting, and filtering large lists 110

Caching 112

9 Fetching Server Data

Using GET or POST requests 115

Cross-domain problems 116

Differences between UNIX and Windows 116

Using canned data 117

Validating your JSON files 118

Caching your server requests 119

10 Localization

Date format 121

Using icons and colors 123

Date and time formatting functions 123

Language localization 127

11 Loading program files

Using a file loader 130

12 Tools

Frameworks 134

Libraries 134

Templates 135

CSS Preprocessors 136

Polyfills and shims 136

Minification tools 136

Script loaders 137

13 Debugging

Chrome developer tools 139

Debugging using console.log 146

Common errors with closures 147

Proper error handling 148

A Interviewing

How to automatically be in the top 50% of candidates 153

Answering technical questions 155

General types of questions at interviews 156

Coding questions 157

Logic/Brainteaser questions 159

Example questions 161

B UI Design

Single page apps 163

General UI goals 163

Models and metaphors 166

Function first-form later 168

Screen size 171

Index 175

From the B&N Reads Blog

Customer Reviews