├── AppendixAES2018AndES2019 ├── ArrayFlatteningMethods │ ├── ArrayprototypeflatMap │ │ ├── ArrayprototypeflatMapExample01.js │ │ ├── ArrayprototypeflatMapExample02.js │ │ └── ArrayprototypeflatMapExample03.js │ └── Arrayprototypeflatten │ │ ├── ArrayprototypeflattenExample01.js │ │ ├── ArrayprototypeflattenExample02.js │ │ └── ArrayprototypeflattenExample03.js ├── AsynchronousIteration │ ├── CreatingAndUsingAnAsyncIterator │ │ ├── CreatingAndUsingAnAsyncIteratorExample01.js │ │ ├── CreatingAndUsingAnAsyncIteratorExample02.js │ │ ├── CreatingAndUsingAnAsyncIteratorExample03.js │ │ └── CreatingAndUsingAnAsyncIteratorExample04.js │ └── ImplementingObservables │ │ ├── ImplementingObservablesExample01.js │ │ └── ImplementingObservablesExample02.js ├── ObjectfromEntries │ └── ObjectfromEntriesExample01.js ├── OptionalCatchBinding │ └── OptionalCatchBindingExample01.js ├── PromiseFinallyDefinition │ ├── PromiseFinallyDefinitionExample01.js │ └── PromiseFinallyDefinitionExample02.js ├── RegularExpressionEnhancements │ ├── DotallFlag │ │ └── DotallFlagExample01.js │ ├── LookbehindAssertions │ │ └── LookbehindAssertionsExample01.js │ └── NamedCaptureGroups │ │ └── NamedCaptureGroupsExample01.js ├── RestAndSpreadOperatorsForObjectLiterals │ ├── RestOperator │ │ ├── RestOperatorExample01.js │ │ ├── RestOperatorExample02.js │ │ └── RestOperatorExample03.js │ └── SpreadOperator │ │ ├── SpreadOperatorExample01.js │ │ └── SpreadOperatorExample02.js └── Symbolprototypedescription │ └── SymbolprototypedescriptionExample01.js ├── AppendixBStrictMode ├── CoercionOfThis │ ├── CoercionOfThisExample01.js │ └── CoercionOfThisExample02.js ├── Eval │ ├── EvalExample01.js │ └── EvalExample02.js ├── EvalAndArguments │ └── EvalAndArgumentsExample01.js ├── Functions │ ├── FunctionParameters │ │ └── FunctionParametersExample01.js │ ├── FunctionsExample01.js │ ├── FunctionsExample02.js │ ├── FunctionsExample03.js │ └── FunctionsExample04.js ├── Objects │ └── ObjectsExample01.js ├── OptingIn │ ├── OptingInExample01.js │ └── OptingInExample02.js ├── OtherChanges │ ├── OtherChangesExample01.js │ └── OtherChangesExample02.js └── Variables │ ├── VariablesExample01.js │ └── VariablesExample02.js ├── Chapter10Functions ├── ArrowFunctions │ ├── ArrowFunctionsExample01.js │ ├── ArrowFunctionsExample02.js │ ├── ArrowFunctionsExample03.js │ └── ArrowFunctionsExample04.js ├── Chapter10FunctionsExample01.js ├── Chapter10FunctionsExample02.js ├── Chapter10FunctionsExample03.js ├── Chapter10FunctionsExample04.js ├── Closures │ ├── ClosuresExample01.js │ ├── ClosuresExample02.js │ ├── ClosuresExample03.js │ ├── ClosuresExample04.js │ ├── MemoryLeaks │ │ ├── MemoryLeaksExample01.js │ │ └── MemoryLeaksExample02.js │ └── TheThisObject │ │ ├── TheThisObjectExample01.js │ │ ├── TheThisObjectExample02.js │ │ ├── TheThisObjectExample03.js │ │ └── TheThisObjectExample04.js ├── DefaultParameterValues │ ├── DefaultParameterScopeAndTemporalDeadZone │ │ ├── DefaultParameterScopeAndTemporalDeadZoneExample01.js │ │ ├── DefaultParameterScopeAndTemporalDeadZoneExample02.js │ │ ├── DefaultParameterScopeAndTemporalDeadZoneExample03.js │ │ └── DefaultParameterScopeAndTemporalDeadZoneExample04.js │ ├── DefaultParameterValuesExample01.js │ ├── DefaultParameterValuesExample02.js │ ├── DefaultParameterValuesExample03.js │ ├── DefaultParameterValuesExample04.js │ └── DefaultParameterValuesExample05.js ├── FunctionDeclarationsVersusFunctionExpressions │ ├── FunctionDeclarationsVersusFunctionExpressionsExample01.js │ ├── FunctionDeclarationsVersusFunctionExpressionsExample02.js │ └── FunctionDeclarationsVersusFunctionExpressionsExample03.js ├── FunctionExpressions │ ├── FunctionExpressionsExample01.js │ ├── FunctionExpressionsExample02.js │ ├── FunctionExpressionsExample03.js │ ├── FunctionExpressionsExample04.js │ ├── FunctionExpressionsExample05.js │ ├── FunctionExpressionsExample06.js │ └── FunctionExpressionsExample07.js ├── FunctionInternals │ ├── Arguments │ │ ├── ArgumentsExample01.js │ │ ├── ArgumentsExample02.js │ │ └── ArgumentsExample03.js │ ├── Caller │ │ ├── CallerExample01.js │ │ └── CallerExample02.js │ └── This │ │ ├── ThisExample01.js │ │ ├── ThisExample02.js │ │ └── ThisExample03.js ├── FunctionNames │ ├── FunctionNamesExample01.js │ └── FunctionNamesExample02.js ├── FunctionPropertiesAndMethods │ ├── FunctionPropertiesAndMethodsExample01.js │ ├── FunctionPropertiesAndMethodsExample02.js │ ├── FunctionPropertiesAndMethodsExample03.js │ ├── FunctionPropertiesAndMethodsExample04.js │ └── FunctionPropertiesAndMethodsExample05.js ├── FunctionsAsValues │ ├── FunctionsAsValuesExample01.js │ ├── FunctionsAsValuesExample02.js │ ├── FunctionsAsValuesExample03.js │ └── FunctionsAsValuesExample04.js ├── ImmediatelyInvokedFunctionExpressions │ ├── ImmediatelyInvokedFunctionExpressionsExample01.js │ ├── ImmediatelyInvokedFunctionExpressionsExample02.js │ ├── ImmediatelyInvokedFunctionExpressionsExample03.js │ ├── ImmediatelyInvokedFunctionExpressionsExample04.js │ ├── ImmediatelyInvokedFunctionExpressionsExample05.js │ └── ImmediatelyInvokedFunctionExpressionsExample06.js ├── NoOverloading │ ├── NoOverloadingExample01.js │ └── NoOverloadingExample02.js ├── PrivateVariables │ ├── PrivateVariablesExample01.js │ ├── PrivateVariablesExample02.js │ ├── PrivateVariablesExample03.js │ ├── StaticPrivateVariables │ │ ├── StaticPrivateVariablesExample01.js │ │ └── StaticPrivateVariablesExample02.js │ ├── TheModuleAugmentationPattern │ │ ├── TheModuleAugmentationPatternExample01.js │ │ └── TheModuleAugmentationPatternExample02.js │ └── TheModulePattern │ │ ├── TheModulePatternExample01.js │ │ ├── TheModulePatternExample02.js │ │ └── TheModulePatternExample03.js ├── Recursion │ ├── RecursionExample01.js │ ├── RecursionExample02.js │ ├── RecursionExample03.js │ └── RecursionExample04.js ├── SpreadArgumentsAndRestParameters │ ├── RestParameter │ │ ├── RestParameterExample01.js │ │ ├── RestParameterExample02.js │ │ └── RestParameterExample03.js │ └── SpreadArguments │ │ ├── SpreadArgumentsExample01.js │ │ ├── SpreadArgumentsExample02.js │ │ ├── SpreadArgumentsExample03.js │ │ ├── SpreadArgumentsExample04.js │ │ └── SpreadArgumentsExample05.js ├── TailCallOptimization │ ├── CodingForTailCallOptimization │ │ ├── CodingForTailCallOptimizationExample01.js │ │ ├── CodingForTailCallOptimizationExample02.js │ │ └── CodingForTailCallOptimizationExample03.js │ ├── TailCallOptimizationExample01.js │ └── TailCallOptimizationRequirements │ │ ├── TailCallOptimizationRequirementsExample01.js │ │ └── TailCallOptimizationRequirementsExample02.js └── UnderstandingArguments │ ├── ArgumentsInArrowFunctions │ ├── ArgumentsInArrowFunctionsExample01.js │ └── ArgumentsInArrowFunctionsExample02.js │ ├── UnderstandingArgumentsExample01.js │ ├── UnderstandingArgumentsExample02.js │ ├── UnderstandingArgumentsExample03.js │ ├── UnderstandingArgumentsExample04.js │ ├── UnderstandingArgumentsExample05.js │ └── UnderstandingArgumentsExample06.js ├── Chapter11PromisesAndAsyncFunctions ├── AsyncFunctions │ ├── AsyncFunctionBasics │ │ ├── RestrictionsOnAwait │ │ │ └── RestrictionsOnAwaitExample01.js │ │ ├── TheAsyncKeyword │ │ │ ├── TheAsyncKeywordExample01.js │ │ │ ├── TheAsyncKeywordExample02.js │ │ │ ├── TheAsyncKeywordExample03.js │ │ │ ├── TheAsyncKeywordExample04.js │ │ │ ├── TheAsyncKeywordExample05.js │ │ │ └── TheAsyncKeywordExample06.js │ │ └── TheAwaitKeyword │ │ │ ├── TheAwaitKeywordExample01.js │ │ │ ├── TheAwaitKeywordExample02.js │ │ │ ├── TheAwaitKeywordExample03.js │ │ │ ├── TheAwaitKeywordExample04.js │ │ │ └── TheAwaitKeywordExample05.js │ ├── AsyncFunctionsExample01.js │ ├── AsyncFunctionsExample02.js │ ├── AsyncFunctionsExample03.js │ ├── HaltingAndResumingExecution │ │ ├── HaltingAndResumingExecutionExample01.js │ │ ├── HaltingAndResumingExecutionExample02.js │ │ ├── HaltingAndResumingExecutionExample03.js │ │ └── HaltingAndResumingExecutionExample04.js │ └── StrategiesForAsyncFunctions │ │ ├── MaximizingParallelization │ │ ├── MaximizingParallelizationExample01.js │ │ ├── MaximizingParallelizationExample02.js │ │ ├── MaximizingParallelizationExample03.js │ │ └── MaximizingParallelizationExample04.js │ │ ├── SerialPromiseExecution │ │ └── SerialPromiseExecutionExample01.js │ │ └── StackTracesAndMemoryManagement │ │ ├── StackTracesAndMemoryManagementExample01.js │ │ └── StackTracesAndMemoryManagementExample02.js ├── IntroductionToAsynchronousProgramming │ ├── LegacyAsynchronousProgrammingPatterns │ │ ├── HandlingFailure │ │ │ └── HandlingFailureExample01.js │ │ ├── LegacyAsynchronousProgrammingPatternsExample01.js │ │ ├── NestingAsynchronousCallbacks │ │ │ └── NestingAsynchronousCallbacksExample01.js │ │ └── ReturningAsynchronousValues │ │ │ └── ReturningAsynchronousValuesExample01.js │ └── SynchronousVsAsynchronousJavaScript │ │ ├── SynchronousVsAsynchronousJavaScriptExample01.js │ │ └── SynchronousVsAsynchronousJavaScriptExample02.js └── Promises │ ├── PromiseBasics │ ├── ControllingPromiseStateWithTheExecutor │ │ ├── ControllingPromiseStateWithTheExecutorExample01.js │ │ ├── ControllingPromiseStateWithTheExecutorExample02.js │ │ ├── ControllingPromiseStateWithTheExecutorExample03.js │ │ ├── ControllingPromiseStateWithTheExecutorExample04.js │ │ └── ControllingPromiseStateWithTheExecutorExample05.js │ ├── PromiseBasicsExample01.js │ ├── PromiseCastingWithPromiseresolve │ │ ├── PromiseCastingWithPromiseresolveExample01.js │ │ ├── PromiseCastingWithPromiseresolveExample02.js │ │ ├── PromiseCastingWithPromiseresolveExample03.js │ │ └── PromiseCastingWithPromiseresolveExample04.js │ ├── PromiseRejectionWithPromisereject │ │ ├── PromiseRejectionWithPromiserejectExample01.js │ │ └── PromiseRejectionWithPromiserejectExample02.js │ └── SynchronousAsynchronousExecutionDuality │ │ └── SynchronousAsynchronousExecutionDualityExample01.js │ ├── PromiseChainingAndComposition │ ├── ParallelPromiseCompositionWithPromiseallAndPromiserace │ │ ├── Promiseall │ │ │ ├── PromiseallExample01.js │ │ │ ├── PromiseallExample02.js │ │ │ ├── PromiseallExample03.js │ │ │ └── PromiseallExample04.js │ │ └── Promiserace │ │ │ ├── PromiseraceExample01.js │ │ │ └── PromiseraceExample02.js │ ├── PromiseChaining │ │ ├── PromiseChainingExample01.js │ │ ├── PromiseChainingExample02.js │ │ ├── PromiseChainingExample03.js │ │ ├── PromiseChainingExample04.js │ │ └── PromiseChainingExample05.js │ ├── PromiseGraphs │ │ └── PromiseGraphsExample01.js │ └── SerialPromiseComposition │ │ ├── SerialPromiseCompositionExample01.js │ │ ├── SerialPromiseCompositionExample02.js │ │ ├── SerialPromiseCompositionExample03.js │ │ └── SerialPromiseCompositionExample04.js │ ├── PromiseExtensions │ ├── PromiseCanceling │ │ ├── PromiseCancelingExample01.js │ │ └── PromiseCancelingExample02.html │ └── PromiseProgressNotifications │ │ ├── PromiseProgressNotificationsExample01.js │ │ ├── PromiseProgressNotificationsExample02.js │ │ ├── PromiseProgressNotificationsExample03.js │ │ └── PromiseProgressNotificationsExample04.js │ └── PromiseInstanceMethods │ ├── ImplementingTheThenableInterface │ └── ImplementingTheThenableInterfaceExample01.js │ ├── NonReentrantPromiseMethods │ ├── NonReentrantPromiseMethodsExample01.js │ └── NonReentrantPromiseMethodsExample02.js │ ├── Promiseprototypecatch │ ├── PromiseprototypecatchExample01.js │ └── PromiseprototypecatchExample02.js │ ├── Promiseprototypefinally │ ├── PromiseprototypefinallyExample01.js │ ├── PromiseprototypefinallyExample02.js │ ├── PromiseprototypefinallyExample03.js │ └── PromiseprototypefinallyExample04.js │ ├── Promiseprototypethen │ ├── PromiseprototypethenExample01.js │ ├── PromiseprototypethenExample02.js │ ├── PromiseprototypethenExample03.js │ ├── PromiseprototypethenExample04.js │ ├── PromiseprototypethenExample05.js │ ├── PromiseprototypethenExample06.js │ └── PromiseprototypethenExample07.js │ ├── RejectingPromisesAndRejectionErrorHandling │ ├── RejectingPromisesAndRejectionErrorHandlingExample01.js │ ├── RejectingPromisesAndRejectionErrorHandlingExample02.js │ └── RejectingPromisesAndRejectionErrorHandlingExample03.js │ └── ResolvedValueAndRejectedReasonPassing │ └── ResolvedValueAndRejectedReasonPassingExample01.js ├── Chapter12TheBrowserObjectModel ├── TheHistoryObject │ ├── HistoryStateManagement │ │ ├── HistoryStateManagementExample01.js │ │ ├── HistoryStateManagementExample02.js │ │ └── HistoryStateManagementExample03.js │ └── Navigation │ │ ├── NavigationExample01.js │ │ ├── NavigationExample02.js │ │ ├── NavigationExample03.js │ │ └── NavigationExample04.js ├── TheLocationObject │ ├── ManipulatingTheLocation │ │ ├── ManipulatingTheLocationExample01.js │ │ ├── ManipulatingTheLocationExample02.js │ │ ├── ManipulatingTheLocationExample03.js │ │ ├── ManipulatingTheLocationExample04.html │ │ └── ManipulatingTheLocationExample05.js │ └── QueryStringArguments │ │ ├── QueryStringArgumentsExample01.js │ │ ├── QueryStringArgumentsExample02.js │ │ └── URLSearchParams │ │ └── URLSearchParamsExample01.js ├── TheNavigatorObject │ ├── DetectingPlugIns │ │ ├── DetectingPlugInsExample01.js │ │ └── LegacyInternetExplorerPluginDetection │ │ │ ├── LegacyInternetExplorerPluginDetectionExample01.js │ │ │ └── LegacyInternetExplorerPluginDetectionExample02.js │ └── RegisteringHandlers │ │ └── RegisteringHandlersExample01.js └── TheWindowObject │ ├── IntervalsAndTimeouts │ ├── IntervalsAndTimeoutsExample01.js │ ├── IntervalsAndTimeoutsExample02.js │ ├── IntervalsAndTimeoutsExample03.js │ ├── IntervalsAndTimeoutsExample04.js │ └── IntervalsAndTimeoutsExample05.js │ ├── NavigatingAndOpeningWindows │ ├── NavigatingAndOpeningWindowsExample01.js │ ├── PopUpBlockers │ │ ├── PopUpBlockersExample01.js │ │ └── PopUpBlockersExample02.js │ └── PoppingUpWindows │ │ ├── PoppingUpWindowsExample01.js │ │ ├── PoppingUpWindowsExample02.js │ │ ├── PoppingUpWindowsExample03.js │ │ ├── PoppingUpWindowsExample04.js │ │ ├── PoppingUpWindowsExample05.js │ │ └── PoppingUpWindowsExample06.js │ ├── SystemDialogs │ ├── SystemDialogsExample01.js │ ├── SystemDialogsExample02.js │ └── SystemDialogsExample03.js │ ├── TheGlobalScope │ ├── TheGlobalScopeExample01.js │ ├── TheGlobalScopeExample02.js │ └── TheGlobalScopeExample03.js │ ├── WindowPositionAndPixelRatio │ └── WindowPositionAndPixelRatioExample01.js │ ├── WindowSize │ ├── WindowSizeExample01.js │ └── WindowSizeExample02.js │ └── WindowViewportPosition │ └── WindowViewportPositionExample01.js ├── Chapter13ClientDetection ├── CapabilityDetection │ ├── CapabilityDetectionExample01.js │ ├── CapabilityDetectionExample02.js │ ├── CapabilityDetectionExample03.js │ ├── SaferCapabilityDetection │ │ ├── SaferCapabilityDetectionExample01.js │ │ ├── SaferCapabilityDetectionExample02.js │ │ ├── SaferCapabilityDetectionExample03.js │ │ └── SaferCapabilityDetectionExample04.js │ └── UsingCapabilityDetectionForBrowserAnalysis │ │ ├── CapabilityDetectionLimitations │ │ └── CapabilityDetectionLimitationsExample01.js │ │ ├── DetectingBrowserIdentity │ │ └── DetectingBrowserIdentityExample01.js │ │ └── DetectingFeatureSupport │ │ └── DetectingFeatureSupportExample01.js ├── SoftwareAndHardwareDetection │ ├── BrowserAndOperatingSystemIdentification │ │ └── TheScreenorientationProperty │ │ │ └── TheScreenorientationPropertyExample01.js │ └── BrowserMetadata │ │ ├── BatteryStatusAPI │ │ └── BatteryStatusAPIExample01.js │ │ ├── ConnectionStateAndTheNetworkInformationAPI │ │ └── ConnectionStateAndTheNetworkInformationAPIExample01.js │ │ └── TheGeolocationAPI │ │ ├── TheGeolocationAPIExample01.js │ │ ├── TheGeolocationAPIExample02.js │ │ ├── TheGeolocationAPIExample03.js │ │ ├── TheGeolocationAPIExample04.js │ │ └── TheGeolocationAPIExample05.js └── UserAgentDetection │ ├── HistoryOfUserAgentComposition │ ├── Chrome │ │ ├── ChromeExample01.js │ │ └── ChromeExample02.js │ ├── EarlyBrowsers │ │ ├── EarlyBrowsersExample01.js │ │ ├── EarlyBrowsersExample02.js │ │ └── EarlyBrowsersExample03.js │ ├── Gecko │ │ ├── GeckoExample01.js │ │ ├── GeckoExample02.js │ │ ├── GeckoExample03.js │ │ ├── GeckoExample04.js │ │ └── GeckoExample05.js │ ├── IosAndAndroid │ │ ├── IosAndAndroidExample01.js │ │ ├── IosAndAndroidExample02.js │ │ └── IosAndAndroidExample03.js │ ├── Konqueror │ │ ├── KonquerorExample01.js │ │ ├── KonquerorExample02.js │ │ └── KonquerorExample03.js │ ├── NetscapeCommunicator4AndInternetExplorer4Through8 │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example01.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example02.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example03.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example04.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example05.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example06.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example07.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example08.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example09.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example10.js │ │ ├── NetscapeCommunicator4AndInternetExplorer4Through8Example11.js │ │ └── NetscapeCommunicator4AndInternetExplorer4Through8Example12.js │ ├── NetscapeNavigator3AndInternetExplorer3 │ │ ├── NetscapeNavigator3AndInternetExplorer3Example01.js │ │ ├── NetscapeNavigator3AndInternetExplorer3Example02.js │ │ └── NetscapeNavigator3AndInternetExplorer3Example03.js │ ├── Opera │ │ ├── OperaExample01.js │ │ ├── OperaExample02.js │ │ ├── OperaExample03.js │ │ ├── OperaExample04.js │ │ ├── OperaExample05.js │ │ ├── OperaExample06.js │ │ └── OperaExample07.js │ └── WebKit │ │ ├── WebKitExample01.js │ │ ├── WebKitExample02.js │ │ └── WebKitExample03.js │ └── UsingUserAgentForBrowserAnalysis │ └── SpoofingAUserAgent │ ├── SpoofingAUserAgentExample01.js │ └── SpoofingAUserAgentExample02.js ├── Chapter14TheDocumentObjectModel ├── HierarchyOfNodes │ ├── HierarchyOfNodesExample01.html │ ├── TheAttrType │ │ └── TheAttrTypeExample01.js │ ├── TheCDATASectionType │ │ └── TheCDATASectionTypeExample01.js │ ├── TheCommentType │ │ ├── TheCommentTypeExample01.js │ │ ├── TheCommentTypeExample02.js │ │ └── TheCommentTypeExample03.js │ ├── TheDocumentFragmentType │ │ ├── TheDocumentFragmentTypeExample01.js │ │ ├── TheDocumentFragmentTypeExample02.js │ │ └── TheDocumentFragmentTypeExample03.js │ ├── TheDocumentType │ │ ├── DOMConformanceDetection │ │ │ └── DOMConformanceDetectionExample01.js │ │ ├── DocumentChildren │ │ │ ├── DocumentChildrenExample01.html │ │ │ ├── DocumentChildrenExample02.html │ │ │ ├── DocumentChildrenExample03.js │ │ │ ├── DocumentChildrenExample04.js │ │ │ └── DocumentChildrenExample05.html │ │ ├── DocumentInformation │ │ │ ├── DocumentInformationExample01.js │ │ │ ├── DocumentInformationExample02.js │ │ │ └── DocumentInformationExample03.js │ │ ├── DocumentWriting │ │ │ ├── DocumentWritingExample01.html │ │ │ ├── DocumentWritingExample02.html │ │ │ ├── DocumentWritingExample03.html │ │ │ └── DocumentWritingExample04.html │ │ └── LocatingElements │ │ │ ├── LocatingElementsExample01.js │ │ │ ├── LocatingElementsExample02.html │ │ │ ├── LocatingElementsExample03.js │ │ │ ├── LocatingElementsExample04.js │ │ │ ├── LocatingElementsExample05.js │ │ │ ├── LocatingElementsExample06.js │ │ │ ├── LocatingElementsExample07.js │ │ │ ├── LocatingElementsExample08.js │ │ │ ├── LocatingElementsExample09.js │ │ │ ├── LocatingElementsExample10.js │ │ │ └── LocatingElementsExample11.js │ ├── TheDocumentTypeType │ │ └── TheDocumentTypeTypeExample01.js │ ├── TheElementType │ │ ├── CreatingElements │ │ │ ├── CreatingElementsExample01.js │ │ │ ├── CreatingElementsExample02.js │ │ │ └── CreatingElementsExample03.js │ │ ├── ElementChildren │ │ │ ├── ElementChildrenExample01.js │ │ │ ├── ElementChildrenExample02.js │ │ │ ├── ElementChildrenExample03.js │ │ │ └── ElementChildrenExample04.js │ │ ├── GettingAttributes │ │ │ ├── GettingAttributesExample01.js │ │ │ ├── GettingAttributesExample02.js │ │ │ ├── GettingAttributesExample03.js │ │ │ └── GettingAttributesExample04.js │ │ ├── HTMLElements │ │ │ ├── HTMLElementsExample01.js │ │ │ ├── HTMLElementsExample02.js │ │ │ ├── HTMLElementsExample03.js │ │ │ └── HTMLElementsExample04.js │ │ ├── SettingAttributes │ │ │ ├── SettingAttributesExample01.js │ │ │ ├── SettingAttributesExample02.js │ │ │ ├── SettingAttributesExample03.js │ │ │ └── SettingAttributesExample04.js │ │ ├── TheAttributesProperty │ │ │ ├── TheAttributesPropertyExample01.js │ │ │ ├── TheAttributesPropertyExample02.js │ │ │ ├── TheAttributesPropertyExample03.js │ │ │ ├── TheAttributesPropertyExample04.js │ │ │ ├── TheAttributesPropertyExample05.js │ │ │ └── TheAttributesPropertyExample06.js │ │ ├── TheElementTypeExample01.js │ │ ├── TheElementTypeExample02.js │ │ └── TheElementTypeExample03.js │ ├── TheNodeType │ │ ├── ManipulatingNodes │ │ │ ├── ManipulatingNodesExample01.js │ │ │ ├── ManipulatingNodesExample02.js │ │ │ ├── ManipulatingNodesExample03.js │ │ │ ├── ManipulatingNodesExample04.js │ │ │ └── ManipulatingNodesExample05.js │ │ ├── NodeRelationships │ │ │ ├── NodeRelationshipsExample01.js │ │ │ ├── NodeRelationshipsExample02.js │ │ │ └── NodeRelationshipsExample03.js │ │ ├── OtherMethods │ │ │ ├── OtherMethodsExample01.js │ │ │ └── OtherMethodsExample02.js │ │ ├── TheNodeTypeExample01.js │ │ └── TheNodenameAndNodevalueProperties │ │ │ └── TheNodenameAndNodevaluePropertiesExample01.js │ └── TheTextType │ │ ├── CreatingTextNodes │ │ ├── CreatingTextNodesExample01.js │ │ ├── CreatingTextNodesExample02.js │ │ └── CreatingTextNodesExample03.js │ │ ├── NormalizingTextNodes │ │ └── NormalizingTextNodesExample01.js │ │ ├── SplittingTextNodes │ │ └── SplittingTextNodesExample01.js │ │ ├── TheTextTypeExample01.html │ │ ├── TheTextTypeExample02.js │ │ ├── TheTextTypeExample03.js │ │ └── TheTextTypeExample04.js ├── MutationObservers │ ├── AsyncCallbacksAndTheRecordQueue │ │ └── TheTakerecordsMethod │ │ │ └── TheTakerecordsMethodExample01.js │ ├── BasicUsage │ │ ├── MultiplexingAMutationObserver │ │ │ └── MultiplexingAMutationObserverExample01.html │ │ ├── TheObserveMethod │ │ │ ├── TheObserveMethodExample01.js │ │ │ └── TheObserveMethodExample02.js │ │ └── WorkingWithCallbacksAndMutationRecords │ │ │ ├── WorkingWithCallbacksAndMutationRecordsExample01.js │ │ │ ├── WorkingWithCallbacksAndMutationRecordsExample02.js │ │ │ └── WorkingWithCallbacksAndMutationRecordsExample03.js │ └── ControllingTheObserverScopeWithMutationObserverInit │ │ ├── ObservingChildMutations │ │ ├── ObservingChildMutationsExample01.js │ │ └── ObservingChildMutationsExample02.js │ │ └── ObservingSubtreeMutations │ │ └── ObservingSubtreeMutationsExample01.js └── WorkingWithTheDOM │ ├── DynamicScripts │ ├── DynamicScriptsExample01.html │ ├── DynamicScriptsExample02.js │ ├── DynamicScriptsExample03.js │ ├── DynamicScriptsExample04.js │ ├── DynamicScriptsExample05.html │ ├── DynamicScriptsExample06.js │ ├── DynamicScriptsExample07.js │ ├── DynamicScriptsExample08.js │ ├── DynamicScriptsExample09.js │ └── DynamicScriptsExample10.js │ ├── DynamicStyles │ ├── DynamicStylesExample01.js │ ├── DynamicStylesExample02.js │ ├── DynamicStylesExample03.js │ ├── DynamicStylesExample04.js │ ├── DynamicStylesExample05.js │ ├── DynamicStylesExample06.js │ ├── DynamicStylesExample07.js │ ├── DynamicStylesExample08.js │ └── DynamicStylesExample09.js │ ├── ManipulatingTables │ ├── ManipulatingTablesExample01.js │ ├── ManipulatingTablesExample02.js │ └── ManipulatingTablesExample03.js │ └── UsingNodeLists │ ├── UsingNodeListsExample01.js │ ├── UsingNodeListsExample02.js │ ├── UsingNodeListsExample03.js │ └── UsingNodeListsExample04.js ├── Chapter15DOMExtensions ├── ElementTraversal │ ├── ElementTraversalExample01.js │ └── ElementTraversalExample02.js ├── HTML5 │ ├── ChangesToHTMLDocument │ │ └── CompatibilityMode │ │ │ └── CompatibilityModeExample01.js │ ├── ClassRelatedAdditions │ │ ├── TheClasslistProperty │ │ │ ├── TheClasslistPropertyExample01.js │ │ │ ├── TheClasslistPropertyExample02.js │ │ │ ├── TheClasslistPropertyExample03.js │ │ │ └── TheClasslistPropertyExample04.js │ │ └── TheGetelementsbyclassnameMethod │ │ │ └── TheGetelementsbyclassnameMethodExample01.js │ ├── CustomDataAttributes │ │ ├── CustomDataAttributesExample01.js │ │ └── CustomDataAttributesExample02.js │ ├── FocusManagement │ │ ├── FocusManagementExample01.js │ │ └── FocusManagementExample02.js │ ├── MarkupInsertion │ │ ├── MemoryAndPerformanceIssues │ │ │ ├── MemoryAndPerformanceIssuesExample01.js │ │ │ └── MemoryAndPerformanceIssuesExample02.js │ │ ├── TheInnerhtmlProperty │ │ │ ├── TheInnerhtmlPropertyExample01.html │ │ │ ├── TheInnerhtmlPropertyExample02.html │ │ │ ├── TheInnerhtmlPropertyExample03.js │ │ │ ├── TheInnerhtmlPropertyExample04.js │ │ │ └── TheInnerhtmlPropertyExample05.js │ │ ├── TheOuterhtmlProperty │ │ │ ├── TheOuterhtmlPropertyExample01.html │ │ │ ├── TheOuterhtmlPropertyExample02.html │ │ │ └── TheOuterhtmlPropertyExample03.js │ │ └── UsingInnerhtmlInLegacyInternetExplorer │ │ │ ├── UsingInnerhtmlInLegacyInternetExplorerExample01.html │ │ │ ├── UsingInnerhtmlInLegacyInternetExplorerExample02.html │ │ │ ├── UsingInnerhtmlInLegacyInternetExplorerExample03.js │ │ │ └── UsingInnerhtmlInLegacyInternetExplorerExample04.js │ └── TheScrollintoviewMethod │ │ └── TheScrollintoviewMethodExample01.js ├── ProprietaryExtensions │ ├── MarkupInsertion │ │ ├── TheInnertextProperty │ │ │ ├── TheInnertextPropertyExample01.html │ │ │ ├── TheInnertextPropertyExample02.js │ │ │ ├── TheInnertextPropertyExample03.js │ │ │ ├── TheInnertextPropertyExample04.js │ │ │ ├── TheInnertextPropertyExample05.js │ │ │ ├── TheInnertextPropertyExample06.js │ │ │ └── TheInnertextPropertyExample07.js │ │ └── TheOutertextProperty │ │ │ ├── TheOutertextPropertyExample01.js │ │ │ └── TheOutertextPropertyExample02.js │ ├── Scrolling │ │ └── ScrollingExample01.js │ └── TheContainsMethod │ │ ├── TheContainsMethodExample01.js │ │ └── TheContainsMethodExample02.js └── SelectorsAPI │ ├── TheMatchesMethod │ └── TheMatchesMethodExample01.js │ ├── TheQueryselectorMethod │ └── TheQueryselectorMethodExample01.js │ └── TheQueryselectorallMethod │ ├── TheQueryselectorallMethodExample01.html │ └── TheQueryselectorallMethodExample02.js ├── Chapter16DOMLevels2And3 ├── DOMChanges │ ├── OtherChanges │ │ ├── ChangesToDocument │ │ │ ├── ChangesToDocumentExample01.js │ │ │ ├── ChangesToDocumentExample02.js │ │ │ ├── ChangesToDocumentExample03.js │ │ │ ├── ChangesToDocumentExample04.js │ │ │ ├── ChangesToDocumentExample05.js │ │ │ └── ChangesToDocumentExample06.js │ │ ├── ChangesToDocumentType │ │ │ ├── ChangesToDocumentTypeExample01.js │ │ │ ├── ChangesToDocumentTypeExample02.js │ │ │ └── ChangesToDocumentTypeExample03.js │ │ ├── ChangesToIframes │ │ │ └── ChangesToIframesExample01.js │ │ └── ChangesToNode │ │ │ ├── ChangesToNodeExample01.js │ │ │ ├── ChangesToNodeExample02.js │ │ │ ├── ChangesToNodeExample03.js │ │ │ └── ChangesToNodeExample04.js │ └── XMLNamespaces │ │ ├── ChangesToDocument │ │ └── ChangesToDocumentExample01.js │ │ ├── ChangesToNode │ │ ├── ChangesToNodeExample01.js │ │ └── ChangesToNodeExample02.js │ │ ├── XMLNamespacesExample01.js │ │ ├── XMLNamespacesExample02.js │ │ ├── XMLNamespacesExample03.js │ │ └── XMLNamespacesExample04.js ├── Ranges │ ├── CollapsingADOMRange │ │ ├── CollapsingADOMRangeExample01.js │ │ └── CollapsingADOMRangeExample02.js │ ├── ComparingDOMRanges │ │ └── ComparingDOMRangesExample01.js │ ├── ComplexSelectionInDOMRanges │ │ ├── ComplexSelectionInDOMRangesExample01.js │ │ ├── ComplexSelectionInDOMRangesExample02.js │ │ └── ComplexSelectionInDOMRangesExample03.js │ ├── InsertingDOMRangeContent │ │ ├── InsertingDOMRangeContentExample01.js │ │ ├── InsertingDOMRangeContentExample02.js │ │ ├── InsertingDOMRangeContentExample03.js │ │ └── InsertingDOMRangeContentExample04.html │ ├── InteractingWithDOMRangeContent │ │ ├── InteractingWithDOMRangeContentExample01.html │ │ ├── InteractingWithDOMRangeContentExample02.js │ │ ├── InteractingWithDOMRangeContentExample03.html │ │ ├── InteractingWithDOMRangeContentExample04.js │ │ ├── InteractingWithDOMRangeContentExample05.html │ │ ├── InteractingWithDOMRangeContentExample06.js │ │ └── InteractingWithDOMRangeContentExample07.html │ ├── RangesInTheDOM │ │ └── RangesInTheDOMExample01.js │ └── SimpleSelectionInDOMRanges │ │ ├── SimpleSelectionInDOMRangesExample01.html │ │ └── SimpleSelectionInDOMRangesExample02.js ├── Styles │ ├── AccessingElementStyles │ │ ├── AccessingElementStylesExample01.js │ │ ├── AccessingElementStylesExample02.js │ │ ├── AccessingElementStylesExample03.js │ │ ├── ComputedStyles │ │ │ └── ComputedStylesExample01.html │ │ └── DOMStylePropertiesAndMethods │ │ │ ├── DOMStylePropertiesAndMethodsExample01.js │ │ │ ├── DOMStylePropertiesAndMethodsExample02.js │ │ │ ├── DOMStylePropertiesAndMethodsExample03.js │ │ │ ├── DOMStylePropertiesAndMethodsExample04.js │ │ │ └── DOMStylePropertiesAndMethodsExample05.js │ ├── ElementDimensions │ │ ├── OffsetDimensions │ │ │ └── OffsetDimensionsExample01.js │ │ └── ScrollDimensions │ │ │ └── ScrollDimensionsExample01.js │ └── WorkingWithStyleSheets │ │ ├── CSSRules │ │ ├── CSSRulesExample01.js │ │ ├── CSSRulesExample02.js │ │ └── CSSRulesExample03.js │ │ ├── CreatingRules │ │ └── CreatingRulesExample01.js │ │ ├── DeletingRules │ │ └── DeletingRulesExample01.js │ │ └── WorkingWithStyleSheetsExample01.js └── Traversals │ ├── NodeIterator │ ├── NodeIteratorExample01.js │ ├── NodeIteratorExample02.js │ ├── NodeIteratorExample03.js │ ├── NodeIteratorExample04.js │ ├── NodeIteratorExample05.html │ ├── NodeIteratorExample06.html │ └── NodeIteratorExample07.js │ ├── TraversalsExample01.html │ └── TreeWalker │ ├── TreeWalkerExample01.js │ ├── TreeWalkerExample02.html │ └── TreeWalkerExample03.js ├── Chapter17Events ├── EventFlow │ └── EventBubbling │ │ └── EventBubblingExample01.html ├── EventHandlers │ ├── CrossBrowserEventHandlers │ │ ├── CrossBrowserEventHandlersExample01.js │ │ └── CrossBrowserEventHandlersExample02.js │ ├── DOMLevel0EventHandlers │ │ ├── DOMLevel0EventHandlersExample01.js │ │ ├── DOMLevel0EventHandlersExample02.js │ │ └── DOMLevel0EventHandlersExample03.js │ ├── DOMLevel2EventHandlers │ │ ├── DOMLevel2EventHandlersExample01.js │ │ ├── DOMLevel2EventHandlersExample02.js │ │ ├── DOMLevel2EventHandlersExample03.js │ │ └── DOMLevel2EventHandlersExample04.js │ ├── HTMLEventHandlers │ │ ├── HTMLEventHandlersExample01.js │ │ ├── HTMLEventHandlersExample02.js │ │ ├── HTMLEventHandlersExample03.html │ │ ├── HTMLEventHandlersExample04.js │ │ ├── HTMLEventHandlersExample05.js │ │ ├── HTMLEventHandlersExample06.js │ │ ├── HTMLEventHandlersExample07.js │ │ ├── HTMLEventHandlersExample08.js │ │ ├── HTMLEventHandlersExample09.js │ │ └── HTMLEventHandlersExample10.js │ └── InternetExplorerEventHandlers │ │ ├── InternetExplorerEventHandlersExample01.js │ │ ├── InternetExplorerEventHandlersExample02.js │ │ ├── InternetExplorerEventHandlersExample03.js │ │ └── InternetExplorerEventHandlersExample04.js ├── EventTypes │ ├── DeviceEvents │ │ ├── TheDeviceorientationEvent │ │ │ ├── TheDeviceorientationEventExample01.js │ │ │ └── TheDeviceorientationEventExample02.js │ │ └── TheOrientationchangeEvent │ │ │ └── TheOrientationchangeEventExample01.js │ ├── EventReference │ │ └── EventReferenceExample01.js │ ├── HTML5Events │ │ ├── TheContextmenuEvent │ │ │ ├── TheContextmenuEventExample01.html │ │ │ └── TheContextmenuEventExample02.js │ │ ├── TheDOMContentLoadedEvent │ │ │ ├── TheDOMContentLoadedEventExample01.js │ │ │ └── TheDOMContentLoadedEventExample02.js │ │ ├── TheHashchangeEvent │ │ │ └── TheHashchangeEventExample01.js │ │ ├── ThePageshowAndPagehideEvents │ │ │ ├── ThePageshowAndPagehideEventsExample01.js │ │ │ ├── ThePageshowAndPagehideEventsExample02.js │ │ │ └── ThePageshowAndPagehideEventsExample03.js │ │ └── TheReadystatechangeEvent │ │ │ ├── TheReadystatechangeEventExample01.js │ │ │ └── TheReadystatechangeEventExample02.js │ ├── KeyboardAndTextEvents │ │ ├── CharacterCodes │ │ │ ├── CharacterCodesExample01.js │ │ │ └── CharacterCodesExample02.js │ │ ├── DOMLevel3Changes │ │ │ ├── DOMLevel3ChangesExample01.js │ │ │ ├── DOMLevel3ChangesExample02.js │ │ │ └── DOMLevel3ChangesExample03.js │ │ ├── KeyCodes │ │ │ └── KeyCodesExample01.js │ │ └── TheTextinputEvent │ │ │ └── TheTextinputEventExample01.js │ ├── MouseAndWheelEvents │ │ ├── ClientCoordinates │ │ │ └── ClientCoordinatesExample01.js │ │ ├── ModifierKeys │ │ │ └── ModifierKeysExample01.js │ │ ├── PageCoordinates │ │ │ └── PageCoordinatesExample01.js │ │ ├── RelatedElements │ │ │ ├── RelatedElementsExample01.html │ │ │ ├── RelatedElementsExample02.js │ │ │ └── RelatedElementsExample03.js │ │ ├── ScreenCoordinates │ │ │ └── ScreenCoordinatesExample01.js │ │ └── TheMousewheelEvent │ │ │ └── TheMousewheelEventExample01.js │ ├── TouchAndGestureEvents │ │ ├── GestureEvents │ │ │ └── GestureEventsExample01.js │ │ └── TouchEvents │ │ │ └── TouchEventsExample01.js │ └── UIEvents │ │ ├── TheLoadEvent │ │ ├── TheLoadEventExample01.js │ │ ├── TheLoadEventExample02.html │ │ ├── TheLoadEventExample03.js │ │ ├── TheLoadEventExample04.js │ │ ├── TheLoadEventExample05.js │ │ ├── TheLoadEventExample06.js │ │ ├── TheLoadEventExample07.js │ │ └── TheLoadEventExample08.js │ │ ├── TheResizeEvent │ │ └── TheResizeEventExample01.js │ │ ├── TheScrollEvent │ │ └── TheScrollEventExample01.js │ │ └── TheUnloadEvent │ │ ├── TheUnloadEventExample01.js │ │ └── TheUnloadEventExample02.html ├── MemoryAndPerformance │ ├── EventDelegation │ │ ├── EventDelegationExample01.js │ │ ├── EventDelegationExample02.js │ │ └── EventDelegationExample03.js │ └── RemovingEventHandlers │ │ ├── RemovingEventHandlersExample01.html │ │ └── RemovingEventHandlersExample02.html ├── SimulatingEvents │ ├── DOMEventSimulation │ │ ├── CustomDOMEvents │ │ │ └── CustomDOMEventsExample01.js │ │ ├── SimulatingKeyboardEvents │ │ │ ├── SimulatingKeyboardEventsExample01.js │ │ │ ├── SimulatingKeyboardEventsExample02.js │ │ │ └── SimulatingKeyboardEventsExample03.js │ │ ├── SimulatingMouseEvents │ │ │ └── SimulatingMouseEventsExample01.js │ │ └── SimulatingOtherEvents │ │ │ └── SimulatingOtherEventsExample01.js │ └── InternetExplorerEventSimulation │ │ ├── InternetExplorerEventSimulationExample01.js │ │ └── InternetExplorerEventSimulationExample02.js └── TheEventObject │ ├── TheCrossBrowserEventObject │ ├── TheCrossBrowserEventObjectExample01.js │ ├── TheCrossBrowserEventObjectExample02.js │ ├── TheCrossBrowserEventObjectExample03.js │ ├── TheCrossBrowserEventObjectExample04.js │ └── TheCrossBrowserEventObjectExample05.js │ ├── TheDOMEventObject │ ├── TheDOMEventObjectExample01.js │ ├── TheDOMEventObjectExample02.js │ ├── TheDOMEventObjectExample03.js │ ├── TheDOMEventObjectExample04.js │ ├── TheDOMEventObjectExample05.js │ ├── TheDOMEventObjectExample06.js │ ├── TheDOMEventObjectExample07.js │ └── TheDOMEventObjectExample08.js │ └── TheInternetExplorerEventObject │ ├── TheInternetExplorerEventObjectExample01.js │ ├── TheInternetExplorerEventObjectExample02.js │ ├── TheInternetExplorerEventObjectExample03.js │ ├── TheInternetExplorerEventObjectExample04.js │ ├── TheInternetExplorerEventObjectExample05.js │ └── TheInternetExplorerEventObjectExample06.js ├── Chapter18AnimationAndGraphicsWithCanvas ├── BasicCanvasUsage │ ├── BasicCanvasUsageExample01.js │ ├── BasicCanvasUsageExample02.js │ └── BasicCanvasUsageExample03.js ├── RequestAnimationFrame │ ├── EarlyAnimationLoops │ │ └── EarlyAnimationLoopsExample01.js │ ├── PerformanceThrottlingWithRequestanimationframe │ │ ├── PerformanceThrottlingWithRequestanimationframeExample01.js │ │ ├── PerformanceThrottlingWithRequestanimationframeExample02.js │ │ └── PerformanceThrottlingWithRequestanimationframeExample03.js │ └── Requestanimationframe │ │ └── RequestanimationframeExample01.js ├── The2dContext │ ├── Compositing │ │ ├── CompositingExample01.js │ │ └── CompositingExample02.js │ ├── DrawingImages │ │ ├── DrawingImagesExample01.js │ │ ├── DrawingImagesExample02.js │ │ └── DrawingImagesExample03.js │ ├── DrawingPaths │ │ ├── DrawingPathsExample01.js │ │ └── DrawingPathsExample02.js │ ├── DrawingRectangles │ │ ├── DrawingRectanglesExample01.js │ │ ├── DrawingRectanglesExample02.js │ │ └── DrawingRectanglesExample03.js │ ├── DrawingText │ │ ├── DrawingTextExample01.js │ │ ├── DrawingTextExample02.js │ │ └── DrawingTextExample03.js │ ├── FillsAndStrokes │ │ └── FillsAndStrokesExample01.js │ ├── Gradients │ │ ├── GradientsExample01.js │ │ ├── GradientsExample02.js │ │ ├── GradientsExample03.js │ │ ├── GradientsExample04.js │ │ ├── GradientsExample05.js │ │ └── GradientsExample06.js │ ├── Patterns │ │ └── PatternsExample01.js │ ├── Shadows │ │ └── ShadowsExample01.js │ ├── Transformations │ │ ├── TransformationsExample01.js │ │ ├── TransformationsExample02.js │ │ └── TransformationsExample03.js │ └── WorkingWithImageData │ │ ├── WorkingWithImageDataExample01.js │ │ ├── WorkingWithImageDataExample02.js │ │ └── WorkingWithImageDataExample03.js └── WebGL │ ├── TheWebGLContext │ └── TheWebGLContextExample01.js │ ├── WebGL1VersusWebGL2 │ ├── WebGL1VersusWebGL2Example01.js │ └── WebGL1VersusWebGL2Example02.js │ └── WebGLBasics │ ├── Buffers │ └── BuffersExample01.js │ ├── Drawing │ └── DrawingExample01.js │ ├── Errors │ └── ErrorsExample01.js │ ├── GettingReadyToDraw │ └── GettingReadyToDrawExample01.js │ ├── ReadingPixels │ ├── ReadingPixelsExample01.js │ └── ReadingPixelsExample02.js │ ├── Shaders │ ├── CreatingShaderPrograms │ │ ├── CreatingShaderProgramsExample01.html │ │ ├── CreatingShaderProgramsExample02.js │ │ ├── CreatingShaderProgramsExample03.js │ │ ├── CreatingShaderProgramsExample04.js │ │ └── CreatingShaderProgramsExample05.js │ ├── DebuggingShadersAndPrograms │ │ ├── DebuggingShadersAndProgramsExample01.js │ │ └── DebuggingShadersAndProgramsExample02.js │ ├── PassingValuesToShaders │ │ ├── PassingValuesToShadersExample01.js │ │ └── PassingValuesToShadersExample02.js │ ├── UpgradingFromGLSL100ToGLSL300 │ │ └── UpgradingFromGLSL100ToGLSL300Example01.js │ └── WritingShaders │ │ ├── WritingShadersExample01.js │ │ └── WritingShadersExample02.js │ ├── Textures │ └── TexturesExample01.js │ ├── ViewportsAndCoordinates │ ├── ViewportsAndCoordinatesExample01.js │ └── ViewportsAndCoordinatesExample02.js │ └── WebGLBasicsExample01.js ├── Chapter19ScriptingForms ├── FormBasics │ ├── FormBasicsExample01.js │ ├── FormBasicsExample02.js │ ├── FormFields │ │ ├── CommonFormFieldEvents │ │ │ └── CommonFormFieldEventsExample01.js │ │ ├── CommonFormFieldMethods │ │ │ ├── CommonFormFieldMethodsExample01.js │ │ │ ├── CommonFormFieldMethodsExample02.js │ │ │ └── CommonFormFieldMethodsExample03.js │ │ ├── CommonFormFieldProperties │ │ │ ├── CommonFormFieldPropertiesExample01.js │ │ │ └── CommonFormFieldPropertiesExample02.js │ │ ├── FormFieldsExample01.js │ │ ├── FormFieldsExample02.js │ │ └── FormFieldsExample03.js │ ├── ResettingForms │ │ ├── ResettingFormsExample01.js │ │ ├── ResettingFormsExample02.js │ │ └── ResettingFormsExample03.js │ └── SubmittingForms │ │ ├── SubmittingFormsExample01.js │ │ ├── SubmittingFormsExample02.js │ │ └── SubmittingFormsExample03.js ├── FormSerialization │ └── FormSerializationExample01.js ├── RichTextEditing │ ├── InteractingWithRichText │ │ ├── InteractingWithRichTextExample01.js │ │ ├── InteractingWithRichTextExample02.js │ │ ├── InteractingWithRichTextExample03.js │ │ ├── InteractingWithRichTextExample04.js │ │ └── InteractingWithRichTextExample05.js │ ├── RichTextEditingExample01.html │ ├── RichTextEditingExample02.html │ ├── RichTextInForms │ │ └── RichTextInFormsExample01.js │ ├── RichTextSelections │ │ ├── RichTextSelectionsExample01.js │ │ ├── RichTextSelectionsExample02.js │ │ └── RichTextSelectionsExample03.js │ └── UsingContenteditable │ │ ├── UsingContenteditableExample01.js │ │ └── UsingContenteditableExample02.js ├── ScriptingSelectBoxes │ ├── AddingOptions │ │ ├── AddingOptionsExample01.js │ │ ├── AddingOptionsExample02.js │ │ └── AddingOptionsExample03.js │ ├── MovingAndReorderingOptions │ │ ├── MovingAndReorderingOptionsExample01.js │ │ ├── MovingAndReorderingOptionsExample02.js │ │ └── MovingAndReorderingOptionsExample03.js │ ├── OptionsSelection │ │ ├── OptionsSelectionExample01.js │ │ ├── OptionsSelectionExample02.js │ │ ├── OptionsSelectionExample03.js │ │ ├── OptionsSelectionExample04.js │ │ └── OptionsSelectionExample05.js │ ├── RemovingOptions │ │ ├── RemovingOptionsExample01.js │ │ ├── RemovingOptionsExample02.js │ │ ├── RemovingOptionsExample03.js │ │ └── RemovingOptionsExample04.js │ ├── ScriptingSelectBoxesExample01.js │ ├── ScriptingSelectBoxesExample02.js │ └── ScriptingSelectBoxesExample03.js └── ScriptingTextBoxes │ ├── AutomaticTabForward │ ├── AutomaticTabForwardExample01.js │ └── AutomaticTabForwardExample02.html │ ├── HTML5ConstraintValidationAPI │ ├── AlternateInputTypes │ │ ├── AlternateInputTypesExample01.js │ │ └── AlternateInputTypesExample02.js │ ├── CheckingValidity │ │ ├── CheckingValidityExample01.js │ │ └── CheckingValidityExample02.js │ ├── DisablingValidation │ │ ├── DisablingValidationExample01.js │ │ ├── DisablingValidationExample02.js │ │ └── DisablingValidationExample03.js │ ├── InputPatterns │ │ ├── InputPatternsExample01.js │ │ └── InputPatternsExample02.js │ ├── NumericRanges │ │ └── NumericRangesExample01.js │ └── RequiredFields │ │ ├── RequiredFieldsExample01.js │ │ ├── RequiredFieldsExample02.js │ │ └── RequiredFieldsExample03.js │ ├── InputFiltering │ ├── BlockingCharacters │ │ ├── BlockingCharactersExample01.js │ │ ├── BlockingCharactersExample02.js │ │ ├── BlockingCharactersExample03.js │ │ └── BlockingCharactersExample04.js │ └── DealingWithTheClipboard │ │ ├── DealingWithTheClipboardExample01.js │ │ └── DealingWithTheClipboardExample02.js │ ├── ScriptingTextBoxesExample01.js │ ├── ScriptingTextBoxesExample02.js │ ├── ScriptingTextBoxesExample03.js │ └── TextSelection │ ├── PartialTextSelection │ ├── PartialTextSelectionExample01.js │ └── PartialTextSelectionExample02.js │ ├── RetrievingSelectedText │ ├── RetrievingSelectedTextExample01.js │ └── RetrievingSelectedTextExample02.js │ ├── TextSelectionExample01.js │ └── TextSelectionExample02.js ├── Chapter1WhatIsJavaScript └── JavaScriptImplementations │ └── TheDocumentObjectModel │ └── TheDocumentObjectModelExample01.html ├── Chapter20JavaScriptAPIs ├── AtomicsAndSharedArrayBuffer │ ├── AtomicsBasics │ │ ├── AtomicArithmeticAndBitwiseMethods │ │ │ ├── AtomicArithmeticAndBitwiseMethodsExample01.js │ │ │ └── AtomicArithmeticAndBitwiseMethodsExample02.js │ │ └── AtomicExchanges │ │ │ ├── AtomicExchangesExample01.js │ │ │ └── AtomicExchangesExample02.js │ └── SharedArrayBuffer │ │ └── SharedArrayBufferExample01.js ├── BlobAndFileAPIs │ ├── BlobsAndPartialReads │ │ ├── BlobsAndPartialReadsExample01.html │ │ └── BlobsAndPartialReadsExample02.js │ ├── DragAndDropFileReading │ │ └── DragAndDropFileReadingExample01.js │ ├── ObjectURLsAndBlobs │ │ └── ObjectURLsAndBlobsExample01.js │ ├── TheFileReaderType │ │ └── TheFileReaderTypeExample01.js │ └── TheFileType │ │ └── TheFileTypeExample01.js ├── CrossContextMessaging │ ├── CrossContextMessagingExample01.js │ └── CrossContextMessagingExample02.js ├── EncodingAPI │ ├── DecodingText │ │ ├── BulkDecoding │ │ │ ├── BulkDecodingExample01.js │ │ │ ├── BulkDecodingExample02.js │ │ │ ├── BulkDecodingExample03.js │ │ │ └── BulkDecodingExample04.js │ │ └── StreamDecoding │ │ │ └── StreamDecodingExample01.js │ └── EncodingText │ │ └── BulkEncoding │ │ ├── BulkEncodingExample01.js │ │ ├── BulkEncodingExample02.js │ │ ├── BulkEncodingExample03.js │ │ └── BulkEncodingExample04.js ├── MediaElements │ ├── CodecSupportDetection │ │ ├── CodecSupportDetectionExample01.js │ │ └── CodecSupportDetectionExample02.js │ ├── CustomMediaPlayers │ │ ├── CustomMediaPlayersExample01.js │ │ └── CustomMediaPlayersExample02.js │ ├── MediaElementsExample01.js │ ├── MediaElementsExample02.js │ └── TheAudioType │ │ └── TheAudioTypeExample01.js ├── NativeDragAndDrop │ ├── CustomDropTargets │ │ └── CustomDropTargetsExample01.js │ └── TheDatatransferObject │ │ ├── TheDatatransferObjectExample01.js │ │ └── TheDatatransferObjectExample02.js ├── NotificationsAPI │ ├── NotificationPermissions │ │ └── NotificationPermissionsExample01.js │ └── ShowingAndHidingNotification │ │ ├── ShowingAndHidingNotificationExample01.js │ │ └── ShowingAndHidingNotificationExample02.js ├── StreamsAPI │ ├── PipingStreams │ │ ├── PipingStreamsExample01.js │ │ └── PipingStreamsExample02.js │ ├── ReadableStreams │ │ ├── UsingTheReadableStreamDefaultController │ │ │ ├── UsingTheReadableStreamDefaultControllerExample01.js │ │ │ └── UsingTheReadableStreamDefaultControllerExample02.js │ │ └── UsingTheReadableStreamDefaultReader │ │ │ └── UsingTheReadableStreamDefaultReaderExample01.js │ ├── TransformStreams │ │ ├── TransformStreamsExample01.js │ │ └── TransformStreamsExample02.js │ └── WritableStreams │ │ └── UsingAWritableStreamDefaultWriter │ │ └── UsingAWritableStreamDefaultWriterExample01.js ├── TheWebCryptographyAPI │ ├── RandomNumberGeneration │ │ ├── RandomNumberGenerationExample01.js │ │ └── RandomNumberGenerationExample02.js │ └── UsingTheSubtleCryptoObject │ │ ├── ExportingAndImportingKeys │ │ └── ExportingAndImportingKeysExample01.js │ │ ├── GeneratingCryptoKeys │ │ └── GeneratingCryptoKeysExample01.js │ │ ├── GeneratingCryptographicDigests │ │ ├── GeneratingCryptographicDigestsExample01.js │ │ └── GeneratingCryptographicDigestsExample02.js │ │ ├── SigningAndVerifyingMessagesWithAsymmetricKeys │ │ └── SigningAndVerifyingMessagesWithAsymmetricKeysExample01.js │ │ └── UsingTheSubtleCryptoObjectExample01.js ├── TimingAPIs │ ├── HighResolutionTimeAPI │ │ ├── HighResolutionTimeAPIExample01.js │ │ ├── HighResolutionTimeAPIExample02.js │ │ └── HighResolutionTimeAPIExample03.js │ └── PerformanceTimelineAPI │ │ ├── PerformanceTimelineAPIExample01.js │ │ ├── PerformanceTimelineAPIExample02.js │ │ ├── ResourceTimingAPI │ │ └── ResourceTimingAPIExample01.js │ │ └── UserTimingAPI │ │ ├── UserTimingAPIExample01.js │ │ └── UserTimingAPIExample02.js └── WebComponents │ ├── CustomElements │ ├── AddingWebComponentContent │ │ ├── AddingWebComponentContentExample01.html │ │ └── AddingWebComponentContentExample02.html │ ├── DefiningACustomElement │ │ ├── DefiningACustomElementExample01.js │ │ ├── DefiningACustomElementExample02.js │ │ ├── DefiningACustomElementExample03.js │ │ └── DefiningACustomElementExample04.js │ ├── ReflectingCustomElementAttributes │ │ └── ReflectingCustomElementAttributesExample01.js │ └── UpgradingCustomElements │ │ ├── UpgradingCustomElementsExample01.js │ │ └── UpgradingCustomElementsExample02.js │ ├── HTMLTemplates │ ├── TemplateScripts │ │ └── TemplateScriptsExample01.html │ ├── UsingADocumentFragment │ │ ├── UsingADocumentFragmentExample01.html │ │ ├── UsingADocumentFragmentExample02.js │ │ └── UsingADocumentFragmentExample03.html │ └── UsingTemplateTags │ │ └── UsingTemplateTagsExample01.html │ └── ShadowDOM │ ├── CompositionAndShadowDOMSlots │ ├── CompositionAndShadowDOMSlotsExample01.html │ ├── CompositionAndShadowDOMSlotsExample02.html │ ├── CompositionAndShadowDOMSlotsExample03.html │ ├── CompositionAndShadowDOMSlotsExample04.html │ └── CompositionAndShadowDOMSlotsExample05.html │ ├── CreatingAShadowDOM │ └── CreatingAShadowDOMExample01.js │ ├── EventRetargeting │ └── EventRetargetingExample01.js │ ├── IntroductionToShadowDOM │ ├── IntroductionToShadowDOMExample01.html │ └── IntroductionToShadowDOMExample02.html │ └── UsingAShadowDOM │ ├── UsingAShadowDOMExample01.html │ ├── UsingAShadowDOMExample02.html │ └── UsingAShadowDOMExample03.html ├── Chapter21ErrorHandlingAndDebugging ├── CommonLegacyInternetExplorerErrors │ ├── MemberNotFound │ │ └── MemberNotFoundExample01.js │ ├── TheSystemCannotLocateTheResourceSpecified │ │ └── TheSystemCannotLocateTheResourceSpecifiedExample01.js │ └── UnknownRuntimeError │ │ └── UnknownRuntimeErrorExample01.html ├── DebuggingTechniques │ ├── LoggingMessagesToAConsole │ │ └── LoggingMessagesToAConsoleExample01.js │ ├── LoggingMessagesToThePage │ │ └── LoggingMessagesToThePageExample01.html │ ├── ShimmingConsoleMethods │ │ └── ShimmingConsoleMethodsExample01.js │ ├── ThrowingErrors │ │ ├── ThrowingErrorsExample01.js │ │ ├── ThrowingErrorsExample02.js │ │ ├── ThrowingErrorsExample03.js │ │ └── ThrowingErrorsExample04.js │ └── UsingTheJavaScriptDebugger │ │ └── UsingTheJavaScriptDebuggerExample01.js └── ErrorHandling │ ├── DistinguishingBetweenFatalAndNonfatalErrors │ ├── DistinguishingBetweenFatalAndNonfatalErrorsExample01.js │ └── DistinguishingBetweenFatalAndNonfatalErrorsExample02.js │ ├── IdentifyWhereErrorsMightOccur │ ├── CommunicationErrors │ │ ├── CommunicationErrorsExample01.js │ │ ├── CommunicationErrorsExample02.js │ │ ├── CommunicationErrorsExample03.js │ │ └── CommunicationErrorsExample04.js │ ├── DataTypeErrors │ │ ├── DataTypeErrorsExample01.js │ │ ├── DataTypeErrorsExample02.js │ │ ├── DataTypeErrorsExample03.js │ │ ├── DataTypeErrorsExample04.js │ │ ├── DataTypeErrorsExample05.js │ │ └── DataTypeErrorsExample06.js │ └── TypeCoercionErrors │ │ ├── TypeCoercionErrorsExample01.js │ │ ├── TypeCoercionErrorsExample02.js │ │ └── TypeCoercionErrorsExample03.js │ ├── LogErrorsToTheServer │ ├── LogErrorsToTheServerExample01.js │ └── LogErrorsToTheServerExample02.js │ ├── TheErrorEvent │ ├── TheErrorEventExample01.js │ ├── TheErrorEventExample02.js │ └── TheErrorEventExample03.js │ ├── TheTryCatchStatement │ ├── ErrorTypes │ │ ├── ErrorTypesExample01.js │ │ ├── ErrorTypesExample02.js │ │ ├── ErrorTypesExample03.js │ │ ├── ErrorTypesExample04.js │ │ ├── ErrorTypesExample05.js │ │ └── ErrorTypesExample06.js │ ├── TheFinallyClause │ │ └── TheFinallyClauseExample01.js │ ├── TheTryCatchStatementExample01.js │ ├── TheTryCatchStatementExample02.js │ └── TheTryCatchStatementExample03.js │ └── ThrowingErrors │ ├── ThrowingErrorsExample01.js │ ├── ThrowingErrorsExample02.js │ ├── ThrowingErrorsExample03.js │ ├── ThrowingErrorsExample04.js │ └── WhenToThrowErrors │ ├── WhenToThrowErrorsExample01.js │ └── WhenToThrowErrorsExample02.js ├── Chapter22XMLInJavaScript ├── XMLDOMSupportInBrowsers │ ├── DOMLevel2Core │ │ ├── DOMLevel2CoreExample01.js │ │ ├── DOMLevel2CoreExample02.js │ │ └── DOMLevel2CoreExample03.js │ ├── TheDOMParserType │ │ ├── TheDOMParserTypeExample01.js │ │ ├── TheDOMParserTypeExample02.js │ │ └── TheDOMParserTypeExample03.js │ └── TheXMLSerializerType │ │ └── TheXMLSerializerTypeExample01.js ├── XPathSupportInBrowsers │ ├── DOMLevel3XPath │ │ ├── DOMLevel3XPathExample01.js │ │ ├── DOMLevel3XPathExample02.js │ │ └── DOMLevel3XPathExample03.js │ ├── DefaultTypeResults │ │ └── DefaultTypeResultsExample01.js │ ├── NamespaceSupport │ │ ├── NamespaceSupportExample01.js │ │ ├── NamespaceSupportExample02.js │ │ └── NamespaceSupportExample03.js │ ├── SimpleTypeResults │ │ ├── SimpleTypeResultsExample01.js │ │ ├── SimpleTypeResultsExample02.js │ │ └── SimpleTypeResultsExample03.js │ └── SingleNodeResults │ │ └── SingleNodeResultsExample01.js └── XSLTSupportInBrowsers │ ├── ResettingTheProcessor │ └── ResettingTheProcessorExample01.js │ ├── TheXSLTProcessorType │ ├── TheXSLTProcessorTypeExample01.js │ ├── TheXSLTProcessorTypeExample02.js │ └── TheXSLTProcessorTypeExample03.html │ └── UsingParameters │ └── UsingParametersExample01.js ├── Chapter23JSON ├── ParsingAndSerialization │ ├── ParsingAndSerializationExample01.js │ ├── ParsingAndSerializationExample02.js │ ├── ParsingOptions │ │ └── ParsingOptionsExample01.js │ ├── SerializationOptions │ │ ├── FilteringResults │ │ │ ├── FilteringResultsExample01.js │ │ │ ├── FilteringResultsExample02.js │ │ │ ├── FilteringResultsExample03.js │ │ │ └── FilteringResultsExample04.js │ │ ├── StringIndentation │ │ │ ├── StringIndentationExample01.js │ │ │ ├── StringIndentationExample02.js │ │ │ ├── StringIndentationExample03.js │ │ │ └── StringIndentationExample04.js │ │ └── TheTojsonMethod │ │ │ └── TheTojsonMethodExample01.js │ └── TheJSONObject │ │ ├── TheJSONObjectExample01.js │ │ ├── TheJSONObjectExample02.js │ │ └── TheJSONObjectExample03.js └── Syntax │ ├── Arrays │ ├── ArraysExample01.js │ ├── ArraysExample02.js │ └── ArraysExample03.js │ ├── Objects │ ├── ObjectsExample01.js │ ├── ObjectsExample02.js │ ├── ObjectsExample03.js │ └── ObjectsExample04.js │ └── SimpleValues │ ├── SimpleValuesExample01.js │ └── SimpleValuesExample02.js ├── Chapter24NetworkRequestsAndRemoteResources ├── AlternateCrossDomainTechniques │ ├── ImagePings │ │ └── ImagePingsExample01.js │ └── JSONP │ │ ├── JSONPExample01.js │ │ ├── JSONPExample02.js │ │ └── JSONPExample03.js ├── CrossOriginResourceSharing │ ├── CredentialedRequests │ │ └── CredentialedRequestsExample01.js │ ├── CrossBrowserCORS │ │ └── CrossBrowserCORSExample01.js │ ├── CrossOriginResourceSharingExample01.js │ ├── CrossOriginResourceSharingExample02.js │ ├── CrossOriginResourceSharingExample03.js │ └── PreflightedRequests │ │ ├── PreflightedRequestsExample01.js │ │ └── PreflightedRequestsExample02.js ├── ProgressEvents │ ├── TheLoadEvent │ │ └── TheLoadEventExample01.js │ └── TheProgressEvent │ │ └── TheProgressEventExample01.js ├── Security │ ├── SecurityExample01.js │ └── SecurityExample02.js ├── TheBeaconAPI │ └── TheBeaconAPIExample01.js ├── TheFetchAPI │ ├── BasicAPIUtilization │ │ ├── DispatchingARequest │ │ │ └── DispatchingARequestExample01.js │ │ ├── HandlingStatusCodesAndRequestFailures │ │ │ ├── HandlingStatusCodesAndRequestFailuresExample01.js │ │ │ ├── HandlingStatusCodesAndRequestFailuresExample02.js │ │ │ ├── HandlingStatusCodesAndRequestFailuresExample03.js │ │ │ ├── HandlingStatusCodesAndRequestFailuresExample04.js │ │ │ ├── HandlingStatusCodesAndRequestFailuresExample05.js │ │ │ └── HandlingStatusCodesAndRequestFailuresExample06.js │ │ └── ReadingAResponse │ │ │ └── ReadingAResponseExample01.js │ ├── CommonFetchPatterns │ │ ├── SendingACrossOriginRequest │ │ │ └── SendingACrossOriginRequestExample01.js │ │ └── SendingFiles │ │ │ └── SendingFilesExample01.js │ ├── RequestsResponsesAndTheBodyMixin │ │ ├── BodyarrayBuffer │ │ │ └── BodyarrayBufferExample01.js │ │ ├── Bodyblob │ │ │ └── BodyblobExample01.js │ │ ├── BodyformData │ │ │ ├── BodyformDataExample01.js │ │ │ ├── BodyformDataExample02.js │ │ │ └── BodyformDataExample03.js │ │ ├── Bodyjson │ │ │ └── BodyjsonExample01.js │ │ ├── Bodytext │ │ │ └── BodytextExample01.js │ │ ├── SingleUseStreams │ │ │ ├── SingleUseStreamsExample01.js │ │ │ └── SingleUseStreamsExample02.js │ │ └── UsingAReadableStreamBody │ │ │ ├── UsingAReadableStreamBodyExample01.js │ │ │ ├── UsingAReadableStreamBodyExample02.js │ │ │ ├── UsingAReadableStreamBodyExample03.js │ │ │ ├── UsingAReadableStreamBodyExample04.js │ │ │ ├── UsingAReadableStreamBodyExample05.js │ │ │ ├── UsingAReadableStreamBodyExample06.js │ │ │ └── UsingAReadableStreamBodyExample07.js │ ├── TheHeadersObject │ │ ├── ExploringHeadersMapSimilarity │ │ │ ├── ExploringHeadersMapSimilarityExample01.js │ │ │ └── ExploringHeadersMapSimilarityExample02.js │ │ └── UniqueFeaturesOfTheHeadersObject │ │ │ └── UniqueFeaturesOfTheHeadersObjectExample01.js │ ├── TheRequestObject │ │ ├── CloningRequestObjects │ │ │ ├── CloningRequestObjectsExample01.js │ │ │ ├── CloningRequestObjectsExample02.js │ │ │ ├── CloningRequestObjectsExample03.js │ │ │ └── CloningRequestObjectsExample04.js │ │ └── CreatingRequestObjects │ │ │ └── CreatingRequestObjectsExample01.js │ └── TheResponseObject │ │ ├── CloningResponseObjects │ │ ├── CloningResponseObjectsExample01.js │ │ └── CloningResponseObjectsExample02.js │ │ └── CreatingResponseObjects │ │ ├── CreatingResponseObjectsExample01.js │ │ ├── CreatingResponseObjectsExample02.js │ │ ├── CreatingResponseObjectsExample03.js │ │ ├── CreatingResponseObjectsExample04.js │ │ └── CreatingResponseObjectsExample05.js ├── TheXMLHttpRequestObject │ ├── GETRequests │ │ ├── GETRequestsExample01.js │ │ ├── GETRequestsExample02.js │ │ └── GETRequestsExample03.js │ ├── HTTPHeaders │ │ ├── HTTPHeadersExample01.js │ │ ├── HTTPHeadersExample02.js │ │ └── HTTPHeadersExample03.js │ ├── POSTRequests │ │ ├── POSTRequestsExample01.js │ │ ├── POSTRequestsExample02.js │ │ └── POSTRequestsExample03.js │ └── XHRUsage │ │ ├── XHRUsageExample01.js │ │ ├── XHRUsageExample02.js │ │ ├── XHRUsageExample03.js │ │ ├── XHRUsageExample04.js │ │ └── XHRUsageExample05.js ├── WebSockets │ ├── OtherEvents │ │ └── OtherEventsExample01.js │ ├── SendingReceivingData │ │ ├── SendingReceivingDataExample01.js │ │ └── SendingReceivingDataExample02.js │ └── TheAPI │ │ ├── TheAPIExample01.js │ │ └── TheAPIExample02.js └── XMLHttpRequestLevel2 │ ├── TheFormDataType │ ├── TheFormDataTypeExample01.js │ ├── TheFormDataTypeExample02.js │ └── TheFormDataTypeExample03.js │ ├── TheOverridemimetypeMethod │ └── TheOverridemimetypeMethodExample01.js │ └── Timeouts │ └── TimeoutsExample01.js ├── Chapter25ClientSideStorage ├── Cookies │ ├── CookieParts │ │ ├── CookiePartsExample01.js │ │ └── CookiePartsExample02.js │ ├── CookiesExample01.js │ ├── CookiesExample02.js │ ├── CookiesInJavaScript │ │ ├── CookiesInJavaScriptExample01.js │ │ ├── CookiesInJavaScriptExample02.js │ │ ├── CookiesInJavaScriptExample03.js │ │ ├── CookiesInJavaScriptExample04.js │ │ ├── CookiesInJavaScriptExample05.js │ │ ├── CookiesInJavaScriptExample06.js │ │ └── CookiesInJavaScriptExample07.js │ └── Subcookies │ │ ├── SubcookiesExample01.js │ │ ├── SubcookiesExample02.js │ │ ├── SubcookiesExample03.js │ │ ├── SubcookiesExample04.js │ │ ├── SubcookiesExample05.js │ │ ├── SubcookiesExample06.js │ │ └── SubcookiesExample07.js ├── IndexedDB │ ├── ConcurrencyIssues │ │ └── ConcurrencyIssuesExample01.js │ ├── Databases │ │ └── DatabasesExample01.js │ ├── Indexes │ │ ├── IndexesExample01.js │ │ ├── IndexesExample02.js │ │ ├── IndexesExample03.js │ │ ├── IndexesExample04.js │ │ ├── IndexesExample05.js │ │ ├── IndexesExample06.js │ │ ├── IndexesExample07.js │ │ └── IndexesExample08.js │ ├── Insertion │ │ ├── InsertionExample01.js │ │ └── InsertionExample02.js │ ├── KeyRanges │ │ ├── KeyRangesExample01.js │ │ ├── KeyRangesExample02.js │ │ ├── KeyRangesExample03.js │ │ ├── KeyRangesExample04.js │ │ ├── KeyRangesExample05.js │ │ ├── KeyRangesExample06.js │ │ └── KeyRangesExample07.js │ ├── ObjectStores │ │ ├── ObjectStoresExample01.js │ │ └── ObjectStoresExample02.js │ ├── QueryingWithCursors │ │ ├── QueryingWithCursorsExample01.js │ │ ├── QueryingWithCursorsExample02.js │ │ ├── QueryingWithCursorsExample03.js │ │ ├── QueryingWithCursorsExample04.js │ │ └── QueryingWithCursorsExample05.js │ ├── SettingCursorDirection │ │ ├── SettingCursorDirectionExample01.js │ │ └── SettingCursorDirectionExample02.js │ └── Transactions │ │ ├── TransactionsExample01.js │ │ ├── TransactionsExample02.js │ │ ├── TransactionsExample03.js │ │ ├── TransactionsExample04.js │ │ ├── TransactionsExample05.js │ │ └── TransactionsExample06.js └── WebStorage │ ├── TheLocalstorageObject │ └── TheLocalstorageObjectExample01.js │ ├── TheSessionstorageObject │ ├── TheSessionstorageObjectExample01.js │ ├── TheSessionstorageObjectExample02.js │ ├── TheSessionstorageObjectExample03.js │ ├── TheSessionstorageObjectExample04.js │ ├── TheSessionstorageObjectExample05.js │ └── TheSessionstorageObjectExample06.js │ └── TheStorageEvent │ └── TheStorageEventExample01.js ├── Chapter26Modules ├── ECMAScript6Modules │ ├── BackwardsCompatibility │ │ └── BackwardsCompatibilityExample01.html │ ├── ModuleExports │ │ ├── ModuleExportsExample01.js │ │ ├── ModuleExportsExample02.js │ │ ├── ModuleExportsExample03.js │ │ ├── ModuleExportsExample04.js │ │ ├── ModuleExportsExample05.js │ │ ├── ModuleExportsExample06.js │ │ ├── ModuleExportsExample07.js │ │ ├── ModuleExportsExample08.js │ │ ├── ModuleExportsExample09.js │ │ ├── ModuleExportsExample10.js │ │ ├── ModuleExportsExample11.js │ │ └── ModuleExportsExample12.js │ ├── ModuleImports │ │ ├── ModuleImportsExample01.js │ │ ├── ModuleImportsExample02.js │ │ ├── ModuleImportsExample03.js │ │ ├── ModuleImportsExample04.js │ │ ├── ModuleImportsExample05.js │ │ ├── ModuleImportsExample06.js │ │ ├── ModuleImportsExample07.js │ │ ├── ModuleImportsExample08.js │ │ └── ModuleImportsExample09.js │ ├── ModulePassthroughExports │ │ ├── ModulePassthroughExportsExample01.js │ │ ├── ModulePassthroughExportsExample02.js │ │ ├── ModulePassthroughExportsExample03.js │ │ └── ModulePassthroughExportsExample04.js │ ├── ModuleTaggingAndDefinition │ │ ├── ModuleTaggingAndDefinitionExample01.html │ │ ├── ModuleTaggingAndDefinitionExample02.html │ │ ├── ModuleTaggingAndDefinitionExample03.html │ │ └── ModuleTaggingAndDefinitionExample04.html │ └── WorkerModules │ │ └── WorkerModulesExample01.js ├── ImprovisingModuleSystems │ ├── ImprovisingModuleSystemsExample01.js │ ├── ImprovisingModuleSystemsExample02.js │ ├── ImprovisingModuleSystemsExample03.js │ ├── ImprovisingModuleSystemsExample04.js │ ├── ImprovisingModuleSystemsExample05.js │ ├── ImprovisingModuleSystemsExample06.js │ ├── ImprovisingModuleSystemsExample07.js │ └── ImprovisingModuleSystemsExample08.js ├── PreES6ModuleLoaders │ ├── AsynchronousModuleDefinition │ │ ├── AsynchronousModuleDefinitionExample01.js │ │ └── AsynchronousModuleDefinitionExample02.js │ ├── CommonJS │ │ ├── CommonJSExample01.js │ │ ├── CommonJSExample02.js │ │ ├── CommonJSExample03.js │ │ ├── CommonJSExample04.js │ │ ├── CommonJSExample05.js │ │ ├── CommonJSExample06.js │ │ ├── CommonJSExample07.js │ │ ├── CommonJSExample08.js │ │ ├── CommonJSExample09.js │ │ ├── CommonJSExample10.js │ │ ├── CommonJSExample11.js │ │ └── CommonJSExample12.js │ └── UniversalModuleDefinition │ │ └── UniversalModuleDefinitionExample01.js └── TheModulePattern │ ├── AsynchronousDependencies │ └── AsynchronousDependenciesExample01.js │ ├── CircularDependencies │ ├── CircularDependenciesExample01.js │ ├── CircularDependenciesExample02.js │ └── CircularDependenciesExample03.js │ ├── EntryPoints │ └── EntryPointsExample01.html │ └── ProgrammaticDependencies │ └── ProgrammaticDependenciesExample01.js ├── Chapter27Workers ├── DedicatedWorkers │ ├── CommunicatingWithADedicatedWorker │ │ ├── CommunicatingWithBroadcastChannel │ │ │ └── CommunicatingWithBroadcastChannelExample01.js │ │ ├── CommunicatingWithMessageChannel │ │ │ ├── CommunicatingWithMessageChannelExample01.js │ │ │ └── CommunicatingWithMessageChannelExample02.js │ │ └── CommunicatingWithPostmessage │ │ │ └── CommunicatingWithPostmessageExample01.js │ ├── CreatingAWorkerFromInlineJavaScript │ │ ├── CreatingAWorkerFromInlineJavaScriptExample01.js │ │ ├── CreatingAWorkerFromInlineJavaScriptExample02.js │ │ └── CreatingAWorkerFromInlineJavaScriptExample03.js │ ├── DedicatedWorkerBasics │ │ ├── CreatingADedicatedWorker │ │ │ └── CreatingADedicatedWorkerExample01.js │ │ ├── TheDedicatedWorkerGlobalScope │ │ │ └── TheDedicatedWorkerGlobalScopeExample01.js │ │ └── WorkerSecurityRestrictions │ │ │ └── WorkerSecurityRestrictionsExample01.js │ ├── DelegatingTasksToSubworkers │ │ └── DelegatingTasksToSubworkersExample01.js │ ├── DynamicScriptExecutionInsideAWorker │ │ ├── DynamicScriptExecutionInsideAWorkerExample01.js │ │ └── DynamicScriptExecutionInsideAWorkerExample02.js │ ├── HandlingWorkerErrors │ │ └── HandlingWorkerErrorsExample01.js │ ├── UnderstandingTheDedicatedWorkerLifecycle │ │ ├── UnderstandingTheDedicatedWorkerLifecycleExample01.js │ │ ├── UnderstandingTheDedicatedWorkerLifecycleExample02.js │ │ └── UnderstandingTheDedicatedWorkerLifecycleExample03.js │ ├── WorkerDataTransfer │ │ ├── SharedArrayBuffer │ │ │ ├── SharedArrayBufferExample01.js │ │ │ ├── SharedArrayBufferExample02.js │ │ │ └── SharedArrayBufferExample03.js │ │ └── TransferableObjects │ │ │ ├── TransferableObjectsExample01.js │ │ │ └── TransferableObjectsExample02.js │ └── WorkerPools │ │ ├── WorkerPoolsExample01.js │ │ ├── WorkerPoolsExample02.js │ │ ├── WorkerPoolsExample03.js │ │ └── WorkerPoolsExample04.js ├── ServiceWorkers │ ├── ForcedServiceWorkerOperation │ │ └── ForcedServiceWorkerOperationExample01.js │ ├── InterceptingAFetchEvent │ │ ├── GenericFallback │ │ │ └── GenericFallbackExample01.js │ │ └── ReturnFromNetwork │ │ │ └── ReturnFromNetworkExample01.js │ ├── ManagingServiceWorkerFileCachingWithUpdateviacache │ │ └── ManagingServiceWorkerFileCachingWithUpdateviacacheExample01.js │ ├── PushNotifications │ │ ├── DisplayingNotifications │ │ │ ├── DisplayingNotificationsExample01.js │ │ │ └── DisplayingNotificationsExample02.js │ │ ├── HandlingNotificationEvents │ │ │ └── HandlingNotificationEventsExample01.js │ │ ├── HandlingPushEvents │ │ │ └── HandlingPushEventsExample01.js │ │ └── SubscribingToPushEvents │ │ │ └── SubscribingToPushEventsExample01.js │ ├── ServiceWorkerBasics │ │ ├── CreatingAServiceWorker │ │ │ ├── CreatingAServiceWorkerExample01.js │ │ │ ├── CreatingAServiceWorkerExample02.js │ │ │ └── CreatingAServiceWorkerExample03.js │ │ ├── ServiceWorkerScopeLimitations │ │ │ ├── ServiceWorkerScopeLimitationsExample01.js │ │ │ ├── ServiceWorkerScopeLimitationsExample02.js │ │ │ ├── ServiceWorkerScopeLimitationsExample03.js │ │ │ ├── ServiceWorkerScopeLimitationsExample04.js │ │ │ ├── ServiceWorkerScopeLimitationsExample05.js │ │ │ └── ServiceWorkerScopeLimitationsExample06.js │ │ ├── UsingTheServiceWorkerContainerObject │ │ │ └── UsingTheServiceWorkerContainerObjectExample01.js │ │ └── UsingTheServiceWorkerRegistrationObject │ │ │ └── UsingTheServiceWorkerRegistrationObjectExample01.js │ ├── ServiceWorkerMessaging │ │ ├── ServiceWorkerMessagingExample01.js │ │ ├── ServiceWorkerMessagingExample02.js │ │ └── ServiceWorkerMessagingExample03.js │ ├── TheServiceWorkerCache │ │ ├── MaximumCacheStorage │ │ │ └── MaximumCacheStorageExample01.js │ │ ├── TheCacheObject │ │ │ ├── TheCacheObjectExample01.js │ │ │ └── TheCacheObjectExample02.js │ │ └── TheCacheStorageObject │ │ │ ├── TheCacheStorageObjectExample01.js │ │ │ ├── TheCacheStorageObjectExample02.js │ │ │ ├── TheCacheStorageObjectExample03.js │ │ │ └── TheCacheStorageObjectExample04.js │ └── UnderstandingTheServiceWorkerLifecycle │ │ ├── TheActivatedState │ │ ├── TheActivatedStateExample01.js │ │ ├── TheActivatedStateExample02.js │ │ └── TheActivatedStateExample03.js │ │ ├── TheActivatingState │ │ ├── TheActivatingStateExample01.js │ │ ├── TheActivatingStateExample02.js │ │ └── TheActivatingStateExample03.js │ │ ├── TheInstalledState │ │ └── TheInstalledStateExample01.js │ │ └── TheInstallingState │ │ ├── TheInstallingStateExample01.js │ │ ├── TheInstallingStateExample02.js │ │ ├── TheInstallingStateExample03.js │ │ ├── TheInstallingStateExample04.js │ │ └── TheInstallingStateExample05.js └── SharedWorkers │ ├── ConnectingToASharedWorker │ ├── ConnectingToASharedWorkerExample01.js │ └── ConnectingToASharedWorkerExample02.js │ ├── SharedWorkerBasics │ ├── CreatingASharedWorker │ │ ├── CreatingASharedWorkerExample01.js │ │ └── CreatingASharedWorkerExample02.js │ └── SharedWorkerIdentityAndSingleOccupancy │ │ ├── SharedWorkerIdentityAndSingleOccupancyExample01.js │ │ ├── SharedWorkerIdentityAndSingleOccupancyExample02.js │ │ ├── SharedWorkerIdentityAndSingleOccupancyExample03.js │ │ ├── SharedWorkerIdentityAndSingleOccupancyExample04.js │ │ └── SharedWorkerIdentityAndSingleOccupancyExample05.js │ └── UnderstandingTheSharedWorkerLifecycle │ ├── UnderstandingTheSharedWorkerLifecycleExample01.js │ └── UnderstandingTheSharedWorkerLifecycleExample02.js ├── Chapter28BestPractices ├── Deployment │ └── BuildProcess │ │ └── TreeShaking │ │ └── TreeShakingExample01.js ├── Maintainability │ ├── CodeConventions │ │ └── VariableTypeTransparency │ │ │ ├── VariableTypeTransparencyExample01.js │ │ │ ├── VariableTypeTransparencyExample02.js │ │ │ ├── VariableTypeTransparencyExample03.js │ │ │ └── VariableTypeTransparencyExample04.js │ ├── LooseCoupling │ │ ├── DecoupleApplicationLogicEventHandlers │ │ │ ├── DecoupleApplicationLogicEventHandlersExample01.js │ │ │ └── DecoupleApplicationLogicEventHandlersExample02.js │ │ ├── DecoupleCSSJavaScript │ │ │ ├── DecoupleCSSJavaScriptExample01.js │ │ │ └── DecoupleCSSJavaScriptExample02.js │ │ └── DecoupleHTMLJavaScript │ │ │ ├── DecoupleHTMLJavaScriptExample01.html │ │ │ └── DecoupleHTMLJavaScriptExample02.html │ └── ProgrammingPractices │ │ ├── AvoidGlobals │ │ ├── AvoidGlobalsExample01.js │ │ ├── AvoidGlobalsExample02.js │ │ ├── AvoidGlobalsExample03.js │ │ └── AvoidGlobalsExample04.js │ │ ├── AvoidNullComparisons │ │ ├── AvoidNullComparisonsExample01.js │ │ └── AvoidNullComparisonsExample02.js │ │ └── RespectObjectOwnership │ │ └── RespectObjectOwnershipExample01.js └── Performance │ ├── BeScopeAware │ ├── AvoidGlobalLookups │ │ ├── AvoidGlobalLookupsExample01.js │ │ └── AvoidGlobalLookupsExample02.js │ └── AvoidTheWithStatement │ │ ├── AvoidTheWithStatementExample01.js │ │ └── AvoidTheWithStatementExample02.js │ ├── ChooseTheRightApproach │ ├── AvoidDoubleInterpretation │ │ ├── AvoidDoubleInterpretationExample01.js │ │ └── AvoidDoubleInterpretationExample02.js │ ├── AvoidUnnecessaryPropertyLookup │ │ ├── AvoidUnnecessaryPropertyLookupExample01.js │ │ ├── AvoidUnnecessaryPropertyLookupExample02.js │ │ ├── AvoidUnnecessaryPropertyLookupExample03.js │ │ ├── AvoidUnnecessaryPropertyLookupExample04.js │ │ └── AvoidUnnecessaryPropertyLookupExample05.js │ ├── OptimizeLoops │ │ ├── OptimizeLoopsExample01.js │ │ ├── OptimizeLoopsExample02.js │ │ └── OptimizeLoopsExample03.js │ └── UnrollingLoops │ │ ├── UnrollingLoopsExample01.js │ │ ├── UnrollingLoopsExample02.js │ │ └── UnrollingLoopsExample03.js │ ├── MinimizeStatementCount │ ├── InsertIterativeValues │ │ ├── InsertIterativeValuesExample01.js │ │ └── InsertIterativeValuesExample02.js │ ├── MultipleVariableDeclarations │ │ ├── MultipleVariableDeclarationsExample01.js │ │ └── MultipleVariableDeclarationsExample02.js │ └── UseArrayAndObjectLiterals │ │ ├── UseArrayAndObjectLiteralsExample01.js │ │ └── UseArrayAndObjectLiteralsExample02.js │ └── OptimizeDOMInteractions │ ├── BewareOfHTMLCollections │ ├── BewareOfHTMLCollectionsExample01.js │ └── BewareOfHTMLCollectionsExample02.js │ ├── MinimizeLiveUpdates │ ├── MinimizeLiveUpdatesExample01.js │ └── MinimizeLiveUpdatesExample02.js │ └── UseInnerhtml │ ├── UseInnerhtmlExample01.js │ └── UseInnerhtmlExample02.js ├── Chapter2JavaScriptInHTML ├── DocumentModes │ ├── DocumentModesExample01.js │ └── DocumentModesExample02.js ├── InlineCodeVersusExternalFiles │ ├── InlineCodeVersusExternalFilesExample01.html │ └── InlineCodeVersusExternalFilesExample02.html ├── TheNoscriptElement │ └── TheNoscriptElementExample01.html └── TheScriptElement │ ├── AsynchronousScripts │ └── AsynchronousScriptsExample01.html │ ├── ChangesInXHTML │ ├── ChangesInXHTMLExample01.html │ ├── ChangesInXHTMLExample02.html │ ├── ChangesInXHTMLExample03.html │ └── ChangesInXHTMLExample04.html │ ├── DeferredScripts │ └── DeferredScriptsExample01.html │ ├── DeprecatedSyntax │ └── DeprecatedSyntaxExample01.html │ ├── DynamicScriptLoading │ ├── DynamicScriptLoadingExample01.js │ └── DynamicScriptLoadingExample02.js │ ├── TagPlacement │ ├── TagPlacementExample01.html │ └── TagPlacementExample02.html │ ├── TheScriptElementExample01.html │ ├── TheScriptElementExample02.html │ ├── TheScriptElementExample03.html │ ├── TheScriptElementExample04.html │ ├── TheScriptElementExample05.html │ └── TheScriptElementExample06.html ├── Chapter3LanguageBasics ├── DataTypes │ ├── TheBooleanType │ │ ├── TheBooleanTypeExample01.js │ │ ├── TheBooleanTypeExample02.js │ │ └── TheBooleanTypeExample03.js │ ├── TheNullType │ │ ├── TheNullTypeExample01.js │ │ ├── TheNullTypeExample02.js │ │ └── TheNullTypeExample03.js │ ├── TheNumberType │ │ ├── FloatingPointValues │ │ │ ├── FloatingPointValuesExample01.js │ │ │ ├── FloatingPointValuesExample02.js │ │ │ ├── FloatingPointValuesExample03.js │ │ │ └── FloatingPointValuesExample04.js │ │ ├── NaN │ │ │ ├── NaNExample01.js │ │ │ └── NaNExample02.js │ │ ├── NumberConversions │ │ │ ├── NumberConversionsExample01.js │ │ │ ├── NumberConversionsExample02.js │ │ │ ├── NumberConversionsExample03.js │ │ │ ├── NumberConversionsExample04.js │ │ │ └── NumberConversionsExample05.js │ │ ├── RangeOfValues │ │ │ └── RangeOfValuesExample01.js │ │ ├── TheNumberTypeExample01.js │ │ ├── TheNumberTypeExample02.js │ │ └── TheNumberTypeExample03.js │ ├── TheObjectType │ │ ├── TheObjectTypeExample01.js │ │ └── TheObjectTypeExample02.js │ ├── TheStringType │ │ ├── CharacterLiterals │ │ │ ├── CharacterLiteralsExample01.js │ │ │ └── CharacterLiteralsExample02.js │ │ ├── ConvertingToAString │ │ │ ├── ConvertingToAStringExample01.js │ │ │ ├── ConvertingToAStringExample02.js │ │ │ └── ConvertingToAStringExample03.js │ │ ├── Interpolation │ │ │ ├── InterpolationExample01.js │ │ │ ├── InterpolationExample02.js │ │ │ ├── InterpolationExample03.js │ │ │ └── InterpolationExample04.js │ │ ├── RawStrings │ │ │ └── RawStringsExample01.js │ │ ├── TemplateLiteralTagFunctions │ │ │ ├── TemplateLiteralTagFunctionsExample01.js │ │ │ └── TemplateLiteralTagFunctionsExample02.js │ │ ├── TemplateLiterals │ │ │ ├── TemplateLiteralsExample01.js │ │ │ └── TemplateLiteralsExample02.html │ │ ├── TheNatureOfStrings │ │ │ └── TheNatureOfStringsExample01.js │ │ └── TheStringTypeExample01.js │ ├── TheSymbolType │ │ ├── BasicSymbolUse │ │ │ ├── BasicSymbolUseExample01.js │ │ │ ├── BasicSymbolUseExample02.js │ │ │ ├── BasicSymbolUseExample03.js │ │ │ └── BasicSymbolUseExample04.js │ │ ├── UsingSymbolsAsProperties │ │ │ ├── UsingSymbolsAsPropertiesExample01.js │ │ │ └── UsingSymbolsAsPropertiesExample02.js │ │ ├── UsingTheGlobalSymbolRegistry │ │ │ ├── UsingTheGlobalSymbolRegistryExample01.js │ │ │ ├── UsingTheGlobalSymbolRegistryExample02.js │ │ │ ├── UsingTheGlobalSymbolRegistryExample03.js │ │ │ ├── UsingTheGlobalSymbolRegistryExample04.js │ │ │ └── UsingTheGlobalSymbolRegistryExample05.js │ │ └── WellKnownSymbols │ │ │ ├── SymbolasyncIterator │ │ │ ├── SymbolasyncIteratorExample01.js │ │ │ └── SymbolasyncIteratorExample02.js │ │ │ ├── SymbolhasInstance │ │ │ ├── SymbolhasInstanceExample01.js │ │ │ └── SymbolhasInstanceExample02.js │ │ │ ├── Symboliterator │ │ │ ├── SymboliteratorExample01.js │ │ │ └── SymboliteratorExample02.js │ │ │ ├── Symbolmatch │ │ │ └── SymbolmatchExample01.js │ │ │ ├── Symbolreplace │ │ │ └── SymbolreplaceExample01.js │ │ │ ├── Symbolsearch │ │ │ └── SymbolsearchExample01.js │ │ │ ├── Symbolsplit │ │ │ └── SymbolsplitExample01.js │ │ │ └── Symbolunscopables │ │ │ └── SymbolunscopablesExample01.js │ ├── TheTypeofOperator │ │ └── TheTypeofOperatorExample01.js │ └── TheUndefinedType │ │ ├── TheUndefinedTypeExample01.js │ │ ├── TheUndefinedTypeExample02.js │ │ ├── TheUndefinedTypeExample03.js │ │ └── TheUndefinedTypeExample04.js ├── Functions │ ├── FunctionsExample01.js │ ├── FunctionsExample02.js │ ├── FunctionsExample03.js │ ├── FunctionsExample04.js │ ├── FunctionsExample05.js │ ├── FunctionsExample06.js │ ├── FunctionsExample07.js │ └── FunctionsExample08.js ├── KeywordsAndReservedWords │ ├── KeywordsAndReservedWordsExample01.js │ └── KeywordsAndReservedWordsExample02.js ├── Operators │ ├── AdditiveOperators │ │ ├── Add │ │ │ ├── AddExample01.js │ │ │ ├── AddExample02.js │ │ │ ├── AddExample03.js │ │ │ └── AddExample04.js │ │ └── Subtract │ │ │ └── SubtractExample01.js │ ├── AssignmentOperators │ │ ├── AssignmentOperatorsExample01.js │ │ ├── AssignmentOperatorsExample02.js │ │ └── AssignmentOperatorsExample03.js │ ├── BitwiseOperators │ │ ├── BitwiseAND │ │ │ ├── BitwiseANDExample01.js │ │ │ └── BitwiseANDExample02.js │ │ ├── BitwiseNOT │ │ │ ├── BitwiseNOTExample01.js │ │ │ └── BitwiseNOTExample02.js │ │ ├── BitwiseOR │ │ │ ├── BitwiseORExample01.js │ │ │ └── BitwiseORExample02.js │ │ ├── BitwiseOperatorsExample01.js │ │ ├── BitwiseOperatorsExample02.js │ │ ├── BitwiseOperatorsExample03.js │ │ ├── BitwiseOperatorsExample04.js │ │ ├── BitwiseXOR │ │ │ ├── BitwiseXORExample01.js │ │ │ └── BitwiseXORExample02.js │ │ ├── LeftShift │ │ │ └── LeftShiftExample01.js │ │ ├── SignedRightShift │ │ │ └── SignedRightShiftExample01.js │ │ └── UnsignedRightShift │ │ │ ├── UnsignedRightShiftExample01.js │ │ │ └── UnsignedRightShiftExample02.js │ ├── BooleanOperators │ │ ├── LogicalAND │ │ │ ├── LogicalANDExample01.js │ │ │ ├── LogicalANDExample02.js │ │ │ └── LogicalANDExample03.js │ │ ├── LogicalNOT │ │ │ └── LogicalNOTExample01.js │ │ └── LogicalOR │ │ │ ├── LogicalORExample01.js │ │ │ ├── LogicalORExample02.js │ │ │ ├── LogicalORExample03.js │ │ │ └── LogicalORExample04.js │ ├── CommaOperator │ │ ├── CommaOperatorExample01.js │ │ └── CommaOperatorExample02.js │ ├── ConditionalOperator │ │ ├── ConditionalOperatorExample01.js │ │ └── ConditionalOperatorExample02.js │ ├── EqualityOperators │ │ └── IdenticallyEqualAndNotIdenticallyEqual │ │ │ ├── IdenticallyEqualAndNotIdenticallyEqualExample01.js │ │ │ └── IdenticallyEqualAndNotIdenticallyEqualExample02.js │ ├── ExponentiationOperator │ │ └── ExponentiationOperatorExample01.js │ ├── MultiplicativeOperators │ │ ├── Divide │ │ │ └── DivideExample01.js │ │ ├── Modulus │ │ │ └── ModulusExample01.js │ │ └── Multiply │ │ │ └── MultiplyExample01.js │ ├── RelationalOperators │ │ ├── RelationalOperatorsExample01.js │ │ ├── RelationalOperatorsExample02.js │ │ ├── RelationalOperatorsExample03.js │ │ ├── RelationalOperatorsExample04.js │ │ ├── RelationalOperatorsExample05.js │ │ ├── RelationalOperatorsExample06.js │ │ └── RelationalOperatorsExample07.js │ └── UnaryOperators │ │ ├── IncrementDecrement │ │ ├── IncrementDecrementExample01.js │ │ ├── IncrementDecrementExample02.js │ │ ├── IncrementDecrementExample03.js │ │ ├── IncrementDecrementExample04.js │ │ ├── IncrementDecrementExample05.js │ │ ├── IncrementDecrementExample06.js │ │ └── IncrementDecrementExample07.js │ │ └── UnaryPlusAndMinus │ │ ├── UnaryPlusAndMinusExample01.js │ │ ├── UnaryPlusAndMinusExample02.js │ │ ├── UnaryPlusAndMinusExample03.js │ │ └── UnaryPlusAndMinusExample04.js ├── Statements │ ├── LabeledStatements │ │ ├── LabeledStatementsExample01.js │ │ └── LabeledStatementsExample02.js │ ├── TheBreakAndContinueStatements │ │ ├── TheBreakAndContinueStatementsExample01.js │ │ ├── TheBreakAndContinueStatementsExample02.js │ │ ├── TheBreakAndContinueStatementsExample03.js │ │ └── TheBreakAndContinueStatementsExample04.js │ ├── TheDoWhileStatement │ │ ├── TheDoWhileStatementExample01.js │ │ └── TheDoWhileStatementExample02.js │ ├── TheForInStatement │ │ ├── TheForInStatementExample01.js │ │ └── TheForInStatementExample02.js │ ├── TheForOfStatement │ │ ├── TheForOfStatementExample01.js │ │ └── TheForOfStatementExample02.js │ ├── TheForStatement │ │ ├── TheForStatementExample01.js │ │ ├── TheForStatementExample02.js │ │ ├── TheForStatementExample03.js │ │ ├── TheForStatementExample04.js │ │ └── TheForStatementExample05.js │ ├── TheIfStatement │ │ ├── TheIfStatementExample01.js │ │ ├── TheIfStatementExample02.js │ │ └── TheIfStatementExample03.js │ ├── TheSwitchStatement │ │ ├── TheSwitchStatementExample01.js │ │ ├── TheSwitchStatementExample02.js │ │ ├── TheSwitchStatementExample03.js │ │ ├── TheSwitchStatementExample04.js │ │ ├── TheSwitchStatementExample05.js │ │ └── TheSwitchStatementExample06.js │ ├── TheWhileStatement │ │ ├── TheWhileStatementExample01.js │ │ └── TheWhileStatementExample02.js │ └── TheWithStatement │ │ ├── TheWithStatementExample01.js │ │ ├── TheWithStatementExample02.js │ │ └── TheWithStatementExample03.js ├── Syntax │ ├── Comments │ │ └── CommentsExample01.js │ ├── Identifiers │ │ └── IdentifiersExample01.js │ ├── Statements │ │ ├── StatementsExample01.js │ │ ├── StatementsExample02.js │ │ └── StatementsExample03.js │ └── StrictMode │ │ ├── StrictModeExample01.js │ │ └── StrictModeExample02.js └── Variables │ ├── ConstDeclarations │ ├── ConstDeclarationsExample01.js │ ├── ConstDeclarationsExample02.js │ └── ConstDeclarationsExample03.js │ ├── LetDeclarations │ ├── ConditionalDeclaration │ │ ├── ConditionalDeclarationExample01.html │ │ └── ConditionalDeclarationExample02.html │ ├── GlobalDeclarations │ │ └── GlobalDeclarationsExample01.js │ ├── LetDeclarationInForLoops │ │ ├── LetDeclarationInForLoopsExample01.js │ │ ├── LetDeclarationInForLoopsExample02.js │ │ ├── LetDeclarationInForLoopsExample03.js │ │ └── LetDeclarationInForLoopsExample04.js │ ├── LetDeclarationsExample01.js │ ├── LetDeclarationsExample02.js │ ├── LetDeclarationsExample03.js │ └── TemporalDeadZone │ │ └── TemporalDeadZoneExample01.js │ └── TheVarKeyword │ ├── TheVarKeywordExample01.js │ ├── TheVarKeywordExample02.js │ ├── TheVarKeywordExample03.js │ ├── VarDeclarationHoisting │ ├── VarDeclarationHoistingExample01.js │ └── VarDeclarationHoistingExample02.js │ └── VarDeclarationScope │ ├── VarDeclarationScopeExample01.js │ ├── VarDeclarationScopeExample02.js │ └── VarDeclarationScopeExample03.js ├── Chapter4VariablesScopeAndMemory ├── ExecutionContextAndScope │ ├── ExecutionContextAndScopeExample01.js │ ├── ExecutionContextAndScopeExample02.js │ ├── ScopeChainAugmentation │ │ └── ScopeChainAugmentationExample01.js │ └── VariableDeclaration │ │ ├── BlockScopeDeclarationUsingLet │ │ ├── BlockScopeDeclarationUsingLetExample01.js │ │ ├── BlockScopeDeclarationUsingLetExample02.js │ │ └── BlockScopeDeclarationUsingLetExample03.js │ │ ├── ConstantDeclarationUsingConst │ │ ├── ConstantDeclarationUsingConstExample01.js │ │ ├── ConstantDeclarationUsingConstExample02.js │ │ ├── ConstantDeclarationUsingConstExample03.js │ │ └── ConstantDeclarationUsingConstExample04.js │ │ ├── FunctionScopeDeclarationUsingVar │ │ ├── FunctionScopeDeclarationUsingVarExample01.js │ │ ├── FunctionScopeDeclarationUsingVarExample02.js │ │ ├── FunctionScopeDeclarationUsingVarExample03.js │ │ └── FunctionScopeDeclarationUsingVarExample04.js │ │ └── IdentifierLookup │ │ ├── IdentifierLookupExample01.js │ │ ├── IdentifierLookupExample02.js │ │ └── IdentifierLookupExample03.js ├── GarbageCollection │ ├── ManagingMemory │ │ ├── HiddenClassesAndTheDeleteOperation │ │ │ ├── HiddenClassesAndTheDeleteOperationExample01.js │ │ │ ├── HiddenClassesAndTheDeleteOperationExample02.js │ │ │ ├── HiddenClassesAndTheDeleteOperationExample03.js │ │ │ └── HiddenClassesAndTheDeleteOperationExample04.js │ │ ├── ManagingMemoryExample01.js │ │ ├── MemoryLeaks │ │ │ ├── MemoryLeaksExample01.js │ │ │ ├── MemoryLeaksExample02.js │ │ │ └── MemoryLeaksExample03.js │ │ └── StaticAllocationAndObjectPools │ │ │ ├── StaticAllocationAndObjectPoolsExample01.js │ │ │ ├── StaticAllocationAndObjectPoolsExample02.js │ │ │ ├── StaticAllocationAndObjectPoolsExample03.js │ │ │ └── StaticAllocationAndObjectPoolsExample04.js │ └── ReferenceCounting │ │ ├── ReferenceCountingExample01.js │ │ ├── ReferenceCountingExample02.js │ │ └── ReferenceCountingExample03.js └── PrimitiveAndReferenceValues │ ├── ArgumentPassing │ ├── ArgumentPassingExample01.js │ ├── ArgumentPassingExample02.js │ └── ArgumentPassingExample03.js │ ├── CopyingValues │ ├── CopyingValuesExample01.js │ └── CopyingValuesExample02.js │ ├── DeterminingType │ ├── DeterminingTypeExample01.js │ ├── DeterminingTypeExample02.js │ └── DeterminingTypeExample03.js │ └── DynamicProperties │ ├── DynamicPropertiesExample01.js │ └── DynamicPropertiesExample02.js ├── Chapter5BasicReferenceTypes ├── Chapter5BasicReferenceTypesExample01.js ├── PrimitiveWrapperTypes │ ├── PrimitiveWrapperTypesExample01.js │ ├── PrimitiveWrapperTypesExample02.js │ ├── PrimitiveWrapperTypesExample03.js │ ├── PrimitiveWrapperTypesExample04.js │ ├── PrimitiveWrapperTypesExample05.js │ ├── TheBooleanType │ │ ├── TheBooleanTypeExample01.js │ │ ├── TheBooleanTypeExample02.js │ │ └── TheBooleanTypeExample03.js │ ├── TheNumberType │ │ ├── TheIsintegerMethodAndSafeIntegers │ │ │ └── TheIsintegerMethodAndSafeIntegersExample01.js │ │ ├── TheNumberTypeExample01.js │ │ ├── TheNumberTypeExample02.js │ │ ├── TheNumberTypeExample03.js │ │ ├── TheNumberTypeExample04.js │ │ ├── TheNumberTypeExample05.js │ │ ├── TheNumberTypeExample06.js │ │ └── TheNumberTypeExample07.js │ └── TheStringType │ │ ├── StringCaseMethods │ │ └── StringCaseMethodsExample01.js │ │ ├── StringInclusionMethods │ │ ├── StringInclusionMethodsExample01.js │ │ └── StringInclusionMethodsExample02.js │ │ ├── StringIteratorsAndDestructuring │ │ ├── StringIteratorsAndDestructuringExample01.js │ │ └── StringIteratorsAndDestructuringExample02.js │ │ ├── StringLocationMethods │ │ ├── StringLocationMethodsExample01.js │ │ ├── StringLocationMethodsExample02.js │ │ └── StringLocationMethodsExample03.js │ │ ├── StringManipulationMethods │ │ ├── StringManipulationMethodsExample01.js │ │ ├── StringManipulationMethodsExample02.js │ │ ├── StringManipulationMethodsExample03.js │ │ └── StringManipulationMethodsExample04.js │ │ ├── StringPatternMatchingMethods │ │ ├── StringPatternMatchingMethodsExample01.js │ │ ├── StringPatternMatchingMethodsExample02.js │ │ ├── StringPatternMatchingMethodsExample03.js │ │ ├── StringPatternMatchingMethodsExample04.js │ │ ├── StringPatternMatchingMethodsExample05.js │ │ └── StringPatternMatchingMethodsExample06.js │ │ ├── TheJavaScriptCharacter │ │ ├── TheJavaScriptCharacterExample01.js │ │ ├── TheJavaScriptCharacterExample02.js │ │ ├── TheJavaScriptCharacterExample03.js │ │ ├── TheJavaScriptCharacterExample04.js │ │ ├── TheJavaScriptCharacterExample05.js │ │ ├── TheJavaScriptCharacterExample06.js │ │ └── TheJavaScriptCharacterExample07.js │ │ ├── TheLocalecompareMethod │ │ ├── TheLocalecompareMethodExample01.js │ │ └── TheLocalecompareMethodExample02.js │ │ ├── TheNormalizeMethod │ │ ├── TheNormalizeMethodExample01.js │ │ ├── TheNormalizeMethodExample02.js │ │ └── TheNormalizeMethodExample03.js │ │ ├── ThePadstartAndPadendMethods │ │ └── ThePadstartAndPadendMethodsExample01.js │ │ ├── TheStringTypeExample01.js │ │ ├── TheStringTypeExample02.js │ │ └── TheTrimMethod │ │ └── TheTrimMethodExample01.js ├── SingletonBuiltInObjects │ ├── TheGlobalObject │ │ ├── TheEvalMethod │ │ │ ├── TheEvalMethodExample01.js │ │ │ ├── TheEvalMethodExample02.js │ │ │ ├── TheEvalMethodExample03.js │ │ │ ├── TheEvalMethodExample04.js │ │ │ ├── TheEvalMethodExample05.js │ │ │ └── TheEvalMethodExample06.js │ │ ├── TheWindowObject │ │ │ ├── TheWindowObjectExample01.js │ │ │ └── TheWindowObjectExample02.js │ │ └── URIEncodingMethods │ │ │ ├── URIEncodingMethodsExample01.js │ │ │ └── URIEncodingMethodsExample02.js │ └── TheMathObject │ │ ├── RoundingMethods │ │ └── RoundingMethodsExample01.js │ │ ├── TheMinAndMaxMethods │ │ └── TheMinAndMaxMethodsExample01.js │ │ └── TheRandomMethod │ │ ├── TheRandomMethodExample01.js │ │ ├── TheRandomMethodExample02.js │ │ ├── TheRandomMethodExample03.js │ │ ├── TheRandomMethodExample04.js │ │ └── TheRandomMethodExample05.js ├── TheDateType │ ├── InheritedMethods │ │ └── InheritedMethodsExample01.js │ ├── TheDateTypeExample01.js │ ├── TheDateTypeExample02.js │ ├── TheDateTypeExample03.js │ ├── TheDateTypeExample04.js │ └── TheDateTypeExample05.js └── TheRegExpType │ ├── RegExpConstructorProperties │ ├── RegExpConstructorPropertiesExample01.js │ ├── RegExpConstructorPropertiesExample02.js │ └── RegExpConstructorPropertiesExample03.js │ ├── RegExpInstanceMethods │ ├── RegExpInstanceMethodsExample01.js │ ├── RegExpInstanceMethodsExample02.js │ ├── RegExpInstanceMethodsExample03.js │ ├── RegExpInstanceMethodsExample04.js │ ├── RegExpInstanceMethodsExample05.js │ └── RegExpInstanceMethodsExample06.js │ ├── RegExpInstanceProperties │ └── RegExpInstancePropertiesExample01.js │ ├── TheRegExpTypeExample01.js │ ├── TheRegExpTypeExample02.js │ ├── TheRegExpTypeExample03.js │ ├── TheRegExpTypeExample04.js │ ├── TheRegExpTypeExample05.js │ └── TheRegExpTypeExample06.js ├── Chapter6CollectionReferenceTypes ├── IterationAndSpreadOperators │ ├── IterationAndSpreadOperatorsExample01.js │ ├── IterationAndSpreadOperatorsExample02.js │ ├── IterationAndSpreadOperatorsExample03.js │ ├── IterationAndSpreadOperatorsExample04.js │ └── IterationAndSpreadOperatorsExample05.js ├── TheArrayType │ ├── ArrayHoles │ │ ├── ArrayHolesExample01.js │ │ ├── ArrayHolesExample02.js │ │ └── ArrayHolesExample03.js │ ├── ConversionMethods │ │ ├── ConversionMethodsExample01.js │ │ ├── ConversionMethodsExample02.js │ │ └── ConversionMethodsExample03.js │ ├── CopyAndFillMethods │ │ ├── CopyAndFillMethodsExample01.js │ │ ├── CopyAndFillMethodsExample02.js │ │ └── CopyAndFillMethodsExample03.js │ ├── CreatingArrays │ │ ├── CreatingArraysExample01.js │ │ ├── CreatingArraysExample02.js │ │ ├── CreatingArraysExample03.js │ │ ├── CreatingArraysExample04.js │ │ ├── CreatingArraysExample05.js │ │ ├── CreatingArraysExample06.js │ │ ├── CreatingArraysExample07.js │ │ └── CreatingArraysExample08.js │ ├── DetectingArrays │ │ └── DetectingArraysExample01.js │ ├── IndexingIntoArrays │ │ ├── IndexingIntoArraysExample01.js │ │ ├── IndexingIntoArraysExample02.js │ │ ├── IndexingIntoArraysExample03.js │ │ ├── IndexingIntoArraysExample04.js │ │ ├── IndexingIntoArraysExample05.js │ │ └── IndexingIntoArraysExample06.js │ ├── IterativeMethods │ │ ├── IterativeMethodsExample01.js │ │ ├── IterativeMethodsExample02.js │ │ ├── IterativeMethodsExample03.js │ │ └── IterativeMethodsExample04.js │ ├── IteratorMethods │ │ ├── IteratorMethodsExample01.js │ │ └── IteratorMethodsExample02.js │ ├── ManipulationMethods │ │ ├── ManipulationMethodsExample01.js │ │ ├── ManipulationMethodsExample02.js │ │ ├── ManipulationMethodsExample03.js │ │ └── ManipulationMethodsExample04.js │ ├── QueueMethods │ │ ├── QueueMethodsExample01.js │ │ └── QueueMethodsExample02.js │ ├── ReductionMethods │ │ ├── ReductionMethodsExample01.js │ │ └── ReductionMethodsExample02.js │ ├── ReorderingMethods │ │ ├── ReorderingMethodsExample01.js │ │ ├── ReorderingMethodsExample02.js │ │ ├── ReorderingMethodsExample03.js │ │ ├── ReorderingMethodsExample04.js │ │ ├── ReorderingMethodsExample05.js │ │ ├── ReorderingMethodsExample06.js │ │ └── ReorderingMethodsExample07.js │ ├── SearchAndLocationMethods │ │ └── PredicateSearch │ │ │ └── PredicateSearchExample01.js │ └── StackMethods │ │ ├── StackMethodsExample01.js │ │ └── StackMethodsExample02.js ├── TheMapType │ ├── BasicAPI │ │ ├── BasicAPIExample01.js │ │ ├── BasicAPIExample02.js │ │ ├── BasicAPIExample03.js │ │ ├── BasicAPIExample04.js │ │ ├── BasicAPIExample05.js │ │ └── BasicAPIExample06.js │ └── OrderAndIteration │ │ ├── OrderAndIterationExample01.js │ │ ├── OrderAndIterationExample02.js │ │ ├── OrderAndIterationExample03.js │ │ └── OrderAndIterationExample04.js ├── TheObjectType │ ├── TheObjectTypeExample01.js │ ├── TheObjectTypeExample02.js │ ├── TheObjectTypeExample03.js │ ├── TheObjectTypeExample04.js │ ├── TheObjectTypeExample05.js │ ├── TheObjectTypeExample06.js │ ├── TheObjectTypeExample07.js │ └── TheObjectTypeExample08.js ├── TheSetType │ ├── BasicAPI │ │ ├── BasicAPIExample01.js │ │ ├── BasicAPIExample02.js │ │ ├── BasicAPIExample03.js │ │ ├── BasicAPIExample04.js │ │ ├── BasicAPIExample05.js │ │ └── BasicAPIExample06.js │ └── OrderAndIteration │ │ ├── OrderAndIterationExample01.js │ │ ├── OrderAndIterationExample02.js │ │ ├── OrderAndIterationExample03.js │ │ └── OrderAndIterationExample04.js ├── TheWeakMapType │ ├── BasicAPI │ │ ├── BasicAPIExample01.js │ │ ├── BasicAPIExample02.js │ │ └── BasicAPIExample03.js │ ├── Utility │ │ ├── DOMNodeMetadata │ │ │ └── DOMNodeMetadataExample01.js │ │ └── PrivateVariables │ │ │ ├── PrivateVariablesExample01.js │ │ │ └── PrivateVariablesExample02.js │ └── WeakKeys │ │ ├── WeakKeysExample01.js │ │ └── WeakKeysExample02.js ├── TheWeakSetType │ ├── BasicAPI │ │ ├── BasicAPIExample01.js │ │ ├── BasicAPIExample02.js │ │ └── BasicAPIExample03.js │ ├── Utility │ │ ├── UtilityExample01.js │ │ └── UtilityExample02.js │ └── WeakKeys │ │ ├── WeakKeysExample01.js │ │ └── WeakKeysExample02.js └── TypedArrays │ ├── DataViews │ ├── CornerCases │ │ └── CornerCasesExample01.js │ └── DataViewsExample01.js │ ├── TypedArrays │ ├── MergingCopyingAndChangingTypedArrays │ │ ├── MergingCopyingAndChangingTypedArraysExample01.js │ │ └── MergingCopyingAndChangingTypedArraysExample02.js │ ├── TypedArrayBehavior │ │ └── TypedArrayBehaviorExample01.js │ ├── TypedArraysExample01.js │ ├── TypedArraysExample02.js │ └── UnderflowAndOverflow │ │ ├── UnderflowAndOverflowExample01.js │ │ └── UnderflowAndOverflowExample02.js │ └── UsingArrayBuffers │ ├── UsingArrayBuffersExample01.js │ └── UsingArrayBuffersExample02.js ├── Chapter7IteratorsAndGenerators ├── Generators │ ├── EarlyTerminationOfGenerators │ │ ├── EarlyTerminationOfGeneratorsExample01.js │ │ ├── TheReturnMethod │ │ │ ├── TheReturnMethodExample01.js │ │ │ └── TheReturnMethodExample02.js │ │ └── TheThrowMethod │ │ │ ├── TheThrowMethodExample01.js │ │ │ └── TheThrowMethodExample02.js │ ├── GeneratorBasics │ │ ├── GeneratorBasicsExample01.js │ │ ├── GeneratorBasicsExample02.js │ │ ├── GeneratorBasicsExample03.js │ │ ├── GeneratorBasicsExample04.js │ │ ├── GeneratorBasicsExample05.js │ │ └── GeneratorBasicsExample06.js │ ├── InterruptingExecutionWithYield │ │ ├── InterruptingExecutionWithYieldExample01.js │ │ ├── InterruptingExecutionWithYieldExample02.js │ │ ├── InterruptingExecutionWithYieldExample03.js │ │ ├── RecursiveAlgorithmsUsingYield │ │ │ ├── RecursiveAlgorithmsUsingYieldExample01.js │ │ │ └── RecursiveAlgorithmsUsingYieldExample02.js │ │ ├── UsingAGeneratorObjectAsAnIterable │ │ │ ├── UsingAGeneratorObjectAsAnIterableExample01.js │ │ │ └── UsingAGeneratorObjectAsAnIterableExample02.js │ │ ├── UsingYieldForInputAndOutput │ │ │ ├── UsingYieldForInputAndOutputExample01.js │ │ │ ├── UsingYieldForInputAndOutputExample02.js │ │ │ ├── UsingYieldForInputAndOutputExample03.js │ │ │ ├── UsingYieldForInputAndOutputExample04.js │ │ │ └── UsingYieldForInputAndOutputExample05.js │ │ └── YieldingAnIterable │ │ │ ├── YieldingAnIterableExample01.js │ │ │ ├── YieldingAnIterableExample02.js │ │ │ ├── YieldingAnIterableExample03.js │ │ │ └── YieldingAnIterableExample04.js │ └── UsingAGeneratorAsTheDefaultIterator │ │ └── UsingAGeneratorAsTheDefaultIteratorExample01.js ├── IntroductionToIteration │ ├── IntroductionToIterationExample01.js │ ├── IntroductionToIterationExample02.js │ └── IntroductionToIterationExample03.js └── TheIteratorPattern │ ├── CustomIteratorDefinition │ ├── CustomIteratorDefinitionExample01.js │ ├── CustomIteratorDefinitionExample02.js │ ├── CustomIteratorDefinitionExample03.js │ └── CustomIteratorDefinitionExample04.js │ ├── EarlyTerminationOfIterators │ ├── EarlyTerminationOfIteratorsExample01.js │ └── EarlyTerminationOfIteratorsExample02.js │ ├── TheIterableProtocol │ ├── TheIterableProtocolExample01.js │ └── TheIterableProtocolExample02.js │ ├── TheIteratorPatternExample01.js │ └── TheIteratorProtocol │ ├── TheIteratorProtocolExample01.js │ ├── TheIteratorProtocolExample02.js │ ├── TheIteratorProtocolExample03.js │ └── TheIteratorProtocolExample04.js ├── Chapter8ObjectsClassesAndObjectOrientedProgramming ├── Classes │ ├── ClassDefinitionBasics │ │ ├── ClassComposition │ │ │ └── ClassCompositionExample01.js │ │ └── ClassDefinitionBasicsExample01.js │ ├── Inheritance │ │ ├── AbstractBaseClass │ │ │ └── AbstractBaseClassExample01.js │ │ ├── ClassMixins │ │ │ ├── ClassMixinsExample01.js │ │ │ ├── ClassMixinsExample02.js │ │ │ └── ClassMixinsExample03.js │ │ ├── ConstructorsHomeObjectsAndSuper │ │ │ ├── ConstructorsHomeObjectsAndSuperExample01.js │ │ │ └── ConstructorsHomeObjectsAndSuperExample02.js │ │ ├── InheritanceBasics │ │ │ ├── InheritanceBasicsExample01.js │ │ │ └── InheritanceBasicsExample02.js │ │ └── InheritingFromBuiltInTypes │ │ │ ├── InheritingFromBuiltInTypesExample01.js │ │ │ └── InheritingFromBuiltInTypesExample02.js │ ├── InstancePrototypeAndClassMembers │ │ ├── IteratorAndGeneratorMethods │ │ │ └── IteratorAndGeneratorMethodsExample01.js │ │ ├── NonFunctionPrototypeAndClassMembers │ │ │ └── NonFunctionPrototypeAndClassMembersExample01.js │ │ ├── PrototypeMethodsAndAccessors │ │ │ ├── PrototypeMethodsAndAccessorsExample01.js │ │ │ ├── PrototypeMethodsAndAccessorsExample02.js │ │ │ └── PrototypeMethodsAndAccessorsExample03.js │ │ └── StaticClassMethodsAndAccessors │ │ │ └── StaticClassMethodsAndAccessorsExample01.js │ └── TheClassConstructor │ │ ├── Instantiation │ │ ├── InstantiationExample01.js │ │ ├── InstantiationExample02.js │ │ └── InstantiationExample03.js │ │ └── UnderstandingClassesAsSpecialFunctions │ │ ├── UnderstandingClassesAsSpecialFunctionsExample01.js │ │ ├── UnderstandingClassesAsSpecialFunctionsExample02.js │ │ └── UnderstandingClassesAsSpecialFunctionsExample03.js ├── Inheritance │ ├── CombinationInheritance │ │ └── CombinationInheritanceExample01.js │ ├── ParasiticCombinationInheritance │ │ ├── ParasiticCombinationInheritanceExample01.js │ │ └── ParasiticCombinationInheritanceExample02.js │ ├── ParasiticInheritance │ │ ├── ParasiticInheritanceExample01.js │ │ └── ParasiticInheritanceExample02.js │ ├── PrototypalInheritance │ │ ├── PrototypalInheritanceExample01.js │ │ ├── PrototypalInheritanceExample02.js │ │ └── PrototypalInheritanceExample03.js │ └── PrototypeChaining │ │ ├── ProblemsWithPrototypeChaining │ │ └── ProblemsWithPrototypeChainingExample01.js │ │ ├── PrototypeAndInstanceRelationships │ │ └── PrototypeAndInstanceRelationshipsExample01.js │ │ ├── PrototypeChainingExample01.js │ │ └── WorkingWithMethods │ │ └── WorkingWithMethodsExample01.js ├── ObjectCreation │ ├── TheFactoryPattern │ │ └── TheFactoryPatternExample01.js │ ├── TheFunctionConstructorPattern │ │ ├── ConstructorsAsFunctions │ │ │ └── ConstructorsAsFunctionsExample01.js │ │ ├── ProblemsWithConstructors │ │ │ ├── ProblemsWithConstructorsExample01.js │ │ │ ├── ProblemsWithConstructorsExample02.js │ │ │ └── ProblemsWithConstructorsExample03.js │ │ ├── TheFunctionConstructorPatternExample01.js │ │ ├── TheFunctionConstructorPatternExample02.js │ │ ├── TheFunctionConstructorPatternExample03.js │ │ └── TheFunctionConstructorPatternExample04.js │ └── ThePrototypePattern │ │ ├── AlternatePrototypeSyntax │ │ ├── AlternatePrototypeSyntaxExample01.js │ │ └── AlternatePrototypeSyntaxExample02.js │ │ ├── DynamicNatureOfPrototypes │ │ ├── DynamicNatureOfPrototypesExample01.js │ │ └── DynamicNatureOfPrototypesExample02.js │ │ ├── HowPrototypesWork │ │ ├── HowPrototypesWorkExample01.js │ │ ├── HowPrototypesWorkExample02.js │ │ ├── HowPrototypesWorkExample03.js │ │ └── HowPrototypesWorkExample04.js │ │ ├── NativeObjectPrototypes │ │ ├── NativeObjectPrototypesExample01.js │ │ └── NativeObjectPrototypesExample02.js │ │ ├── PrototypesAndTheInOperator │ │ ├── PrototypesAndTheInOperatorExample01.js │ │ ├── PrototypesAndTheInOperatorExample02.js │ │ ├── PrototypesAndTheInOperatorExample03.js │ │ ├── PrototypesAndTheInOperatorExample04.js │ │ └── PrototypesAndTheInOperatorExample05.js │ │ ├── ThePrototypePatternExample01.js │ │ ├── ThePrototypePatternExample02.js │ │ └── UnderstandingThePrototypeHierarchy │ │ ├── UnderstandingThePrototypeHierarchyExample01.js │ │ ├── UnderstandingThePrototypeHierarchyExample02.js │ │ └── UnderstandingThePrototypeHierarchyExample03.js └── UnderstandingObjects │ ├── EnhancedObjectSyntax │ ├── ComputedPropertyKeys │ │ ├── ComputedPropertyKeysExample01.js │ │ ├── ComputedPropertyKeysExample02.js │ │ └── ComputedPropertyKeysExample03.js │ ├── ConciseMethodSyntax │ │ ├── ConciseMethodSyntaxExample01.js │ │ ├── ConciseMethodSyntaxExample02.js │ │ ├── ConciseMethodSyntaxExample03.js │ │ └── ConciseMethodSyntaxExample04.js │ └── PropertyValueShorthand │ │ ├── PropertyValueShorthandExample01.js │ │ ├── PropertyValueShorthandExample02.js │ │ └── PropertyValueShorthandExample03.js │ ├── MergingObjects │ ├── MergingObjectsExample01.js │ └── MergingObjectsExample02.js │ ├── ObjectDestructuring │ ├── NestedDestructuring │ │ ├── NestedDestructuringExample01.js │ │ └── NestedDestructuringExample02.js │ ├── ObjectDestructuringExample01.js │ ├── ObjectDestructuringExample02.js │ ├── ObjectDestructuringExample03.js │ ├── ObjectDestructuringExample04.js │ └── ObjectDestructuringExample05.js │ ├── ObjectIdentityAndEquality │ ├── ObjectIdentityAndEqualityExample01.js │ └── ObjectIdentityAndEqualityExample02.js │ ├── TypesOfProperties │ ├── AccessorProperties │ │ └── AccessorPropertiesExample01.js │ └── DataProperties │ │ ├── DataPropertiesExample01.js │ │ ├── DataPropertiesExample02.js │ │ └── DataPropertiesExample03.js │ └── UnderstandingObjectsExample01.js ├── Chapter9ProxiesAndReflect ├── ProxyFundamentals │ ├── DefiningTraps │ │ └── DefiningTrapsExample01.js │ ├── ProxyConsiderationsAndShortcomings │ │ └── ThisInsideAProxy │ │ │ ├── ThisInsideAProxyExample01.js │ │ │ ├── ThisInsideAProxyExample02.js │ │ │ └── ThisInsideAProxyExample03.js │ ├── TrapParametersAndTheReflectAPI │ │ ├── TrapParametersAndTheReflectAPIExample01.js │ │ ├── TrapParametersAndTheReflectAPIExample02.js │ │ ├── TrapParametersAndTheReflectAPIExample03.js │ │ └── TrapParametersAndTheReflectAPIExample04.js │ └── UtilityOfTheReflectAPI │ │ ├── SafeFunctionApplication │ │ └── SafeFunctionApplicationExample01.js │ │ └── StatusFlags │ │ ├── StatusFlagsExample01.js │ │ └── StatusFlagsExample02.js └── ProxyPatterns │ ├── DataBindingAndObservables │ └── DataBindingAndObservablesExample01.js │ └── FunctionAndConstructorParameterValidation │ └── FunctionAndConstructorParameterValidationExample01.js ├── LICENSE ├── README.md └── extract.py /AppendixAES2018AndES2019/OptionalCatchBinding/OptionalCatchBindingExample01.js: -------------------------------------------------------------------------------- 1 | try { 2 | throw 'foo'; 3 | } catch (e) { 4 | // An error happened, but you don't care about the error object 5 | } 6 | -------------------------------------------------------------------------------- /AppendixAES2018AndES2019/RegularExpressionEnhancements/DotallFlag/DotallFlagExample01.js: -------------------------------------------------------------------------------- 1 | const text = ` 2 | foo 3 | bar 4 | `; 5 | 6 | const re = /foo.bar/; 7 | 8 | console.log(re.test(text)); // false 9 | -------------------------------------------------------------------------------- /AppendixAES2018AndES2019/Symbolprototypedescription/SymbolprototypedescriptionExample01.js: -------------------------------------------------------------------------------- 1 | const s = Symbol('foo'); 2 | 3 | console.log(s.toString()); 4 | // Symbol(foo) 5 | -------------------------------------------------------------------------------- /AppendixBStrictMode/CoercionOfThis/CoercionOfThisExample02.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.log(this); 3 | } 4 | 5 | foo.call(); // Window {} 6 | foo.call(2); // Number {2} 7 | -------------------------------------------------------------------------------- /AppendixBStrictMode/Eval/EvalExample02.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | let result = eval("let x = 10, y = 11; x + y"); 3 | alert(result); // 21 4 | -------------------------------------------------------------------------------- /AppendixBStrictMode/Functions/FunctionsExample01.js: -------------------------------------------------------------------------------- 1 | // Duplicate named arguments 2 | // Non-strict mode: No error, only second argument works 3 | // Strict mode: Throws a SyntaxError 4 | function sum (num, num){ 5 | // do something 6 | } 7 | -------------------------------------------------------------------------------- /AppendixBStrictMode/OptingIn/OptingInExample01.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | -------------------------------------------------------------------------------- /AppendixBStrictMode/OptingIn/OptingInExample02.js: -------------------------------------------------------------------------------- 1 | function doSomething() { 2 | "use strict"; 3 | // other processing 4 | } 5 | -------------------------------------------------------------------------------- /AppendixBStrictMode/OtherChanges/OtherChangesExample01.js: -------------------------------------------------------------------------------- 1 | // Use of the with statement 2 | // Non-strict mode: Allowed 3 | // Strict mode: Throws a syntax error 4 | with(location) { 5 | alert(href); 6 | } 7 | -------------------------------------------------------------------------------- /AppendixBStrictMode/OtherChanges/OtherChangesExample02.js: -------------------------------------------------------------------------------- 1 | // Use of octal literal 2 | // Non-strict mode: value is 8. 3 | // Strict mode: throws a syntax error. 4 | let value = 010; 5 | -------------------------------------------------------------------------------- /AppendixBStrictMode/Variables/VariablesExample01.js: -------------------------------------------------------------------------------- 1 | // Variable is not declared 2 | // Non-strict mode: creates a global 3 | // Strict mode: Throws a ReferenceError 4 | message = "Hello world!"; 5 | -------------------------------------------------------------------------------- /AppendixBStrictMode/Variables/VariablesExample02.js: -------------------------------------------------------------------------------- 1 | // Deleting a variable 2 | // Non-strict mode: Fails silently 3 | // Strict mode: Throws a ReferenceError 4 | let color = "red"; 5 | delete color; 6 | -------------------------------------------------------------------------------- /Chapter10Functions/ArrowFunctions/ArrowFunctionsExample02.js: -------------------------------------------------------------------------------- 1 | let ints = [1, 2, 3]; 2 | 3 | console.log(ints.map(function(i) { return i + 1; })); // [2, 3, 4] 4 | console.log(ints.map((i) => { return i + 1 })); // [2, 3, 4] 5 | -------------------------------------------------------------------------------- /Chapter10Functions/Chapter10FunctionsExample01.js: -------------------------------------------------------------------------------- 1 | function sum (num1, num2) { 2 | return num1 + num2; 3 | } 4 | -------------------------------------------------------------------------------- /Chapter10Functions/Chapter10FunctionsExample02.js: -------------------------------------------------------------------------------- 1 | let sum = function(num1, num2) { 2 | return num1 + num2; 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter10Functions/Chapter10FunctionsExample03.js: -------------------------------------------------------------------------------- 1 | let sum = (num1, num2) => { 2 | return num1 + num2; 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter10Functions/Chapter10FunctionsExample04.js: -------------------------------------------------------------------------------- 1 | let sum = new Function("num1", "num2", "return num1 + num2"); // not recommended 2 | -------------------------------------------------------------------------------- /Chapter10Functions/Closures/ClosuresExample03.js: -------------------------------------------------------------------------------- 1 | let compare = createComparisonFunction('name'); 2 | let result = compare({ name: 'Nicholas' }, { name: 'Matt' }); 3 | -------------------------------------------------------------------------------- /Chapter10Functions/Closures/MemoryLeaks/MemoryLeaksExample01.js: -------------------------------------------------------------------------------- 1 | function assignHandler() { 2 | let element = document.getElementById('someElement'); 3 | element.onclick = () => console.log(element.id); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter10Functions/Closures/TheThisObject/TheThisObjectExample03.js: -------------------------------------------------------------------------------- 1 | window.identity = 'The Window'; 2 | let object = { 3 | identity: 'My Object', 4 | getIdentity () { 5 | return this.identity; 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionDeclarationsVersusFunctionExpressions/FunctionDeclarationsVersusFunctionExpressionsExample01.js: -------------------------------------------------------------------------------- 1 | // OK 2 | console.log(sum(10, 10)); 3 | function sum(num1, num2) { 4 | return num1 + num2; 5 | } 6 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionDeclarationsVersusFunctionExpressions/FunctionDeclarationsVersusFunctionExpressionsExample02.js: -------------------------------------------------------------------------------- 1 | // Error 2 | console.log(sum(10, 10)); 3 | let sum = function(num1, num2) { 4 | return num1 + num2; 5 | }; 6 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionDeclarationsVersusFunctionExpressions/FunctionDeclarationsVersusFunctionExpressionsExample03.js: -------------------------------------------------------------------------------- 1 | console.log(sum(10, 10)); 2 | var sum = function(num1, num2) { 3 | return num1 + num2; 4 | }; 5 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionExpressions/FunctionExpressionsExample01.js: -------------------------------------------------------------------------------- 1 | function functionName(arg0, arg1, arg2) { 2 | // function body 3 | } 4 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionExpressions/FunctionExpressionsExample02.js: -------------------------------------------------------------------------------- 1 | sayHi(); 2 | function sayHi() { 3 | console.log("Hi!"); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionExpressions/FunctionExpressionsExample03.js: -------------------------------------------------------------------------------- 1 | let functionName = function(arg0, arg1, arg2) { 2 | // function body 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionExpressions/FunctionExpressionsExample04.js: -------------------------------------------------------------------------------- 1 | sayHi(); // Error! function doesn't exist yet 2 | let sayHi = function() { 3 | console.log("Hi!"); 4 | }; 5 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionInternals/Arguments/ArgumentsExample01.js: -------------------------------------------------------------------------------- 1 | function factorial(num) { 2 | if (num <= 1) { 3 | return 1; 4 | } else { 5 | return num * factorial(num - 1); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionInternals/Arguments/ArgumentsExample02.js: -------------------------------------------------------------------------------- 1 | function factorial(num) { 2 | if (num <= 1) { 3 | return 1; 4 | } else { 5 | return num * arguments.callee(num - 1); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionInternals/Caller/CallerExample01.js: -------------------------------------------------------------------------------- 1 | function outer() { 2 | inner(); 3 | } 4 | function inner() { 5 | console.log(inner.caller); 6 | } 7 | outer(); 8 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionInternals/Caller/CallerExample02.js: -------------------------------------------------------------------------------- 1 | function outer() { 2 | inner(); 3 | } 4 | 5 | function inner() { 6 | console.log(arguments.callee.caller); 7 | } 8 | 9 | outer(); 10 | -------------------------------------------------------------------------------- /Chapter10Functions/FunctionsAsValues/FunctionsAsValuesExample01.js: -------------------------------------------------------------------------------- 1 | function callSomeFunction(someFunction, someArgument) { 2 | return someFunction(someArgument); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter10Functions/ImmediatelyInvokedFunctionExpressions/ImmediatelyInvokedFunctionExpressionsExample01.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | // block code here 3 | })(); 4 | -------------------------------------------------------------------------------- /Chapter10Functions/PrivateVariables/PrivateVariablesExample01.js: -------------------------------------------------------------------------------- 1 | function add(num1, num2) { 2 | let sum = num1 + num2; 3 | return sum; 4 | } 5 | -------------------------------------------------------------------------------- /Chapter10Functions/PrivateVariables/TheModulePattern/TheModulePatternExample01.js: -------------------------------------------------------------------------------- 1 | let singleton = { 2 | name: value, 3 | method() { 4 | // method code here 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /Chapter10Functions/Recursion/RecursionExample01.js: -------------------------------------------------------------------------------- 1 | function factorial(num) { 2 | if (num <= 1) { 3 | return 1; 4 | } else { 5 | return num * factorial(num - 1); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Chapter10Functions/Recursion/RecursionExample02.js: -------------------------------------------------------------------------------- 1 | let anotherFactorial = factorial; 2 | factorial = null; 3 | console.log(anotherFactorial(4)); // error! 4 | -------------------------------------------------------------------------------- /Chapter10Functions/Recursion/RecursionExample03.js: -------------------------------------------------------------------------------- 1 | function factorial(num) { 2 | if (num <= 1) { 3 | return 1; 4 | } else { 5 | return num * arguments.callee(num - 1); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Chapter10Functions/Recursion/RecursionExample04.js: -------------------------------------------------------------------------------- 1 | const factorial = (function f(num) { 2 | if (num <= 1) { 3 | return 1; 4 | } else { 5 | return num * f(num - 1); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /Chapter10Functions/SpreadArgumentsAndRestParameters/RestParameter/RestParameterExample03.js: -------------------------------------------------------------------------------- 1 | let getSum = (...values) => { 2 | return values.reduce((x, y) => x + y, 0); 3 | } 4 | 5 | console.log(getSum(1,2,3)); // 6 6 | -------------------------------------------------------------------------------- /Chapter10Functions/SpreadArgumentsAndRestParameters/SpreadArguments/SpreadArgumentsExample02.js: -------------------------------------------------------------------------------- 1 | console.log(getSum.apply(null, values)); // 10 2 | -------------------------------------------------------------------------------- /Chapter10Functions/SpreadArgumentsAndRestParameters/SpreadArguments/SpreadArgumentsExample03.js: -------------------------------------------------------------------------------- 1 | console.log(getSum(...values)); // 10 2 | -------------------------------------------------------------------------------- /Chapter10Functions/TailCallOptimization/CodingForTailCallOptimization/CodingForTailCallOptimizationExample02.js: -------------------------------------------------------------------------------- 1 | fib(1000); 2 | -------------------------------------------------------------------------------- /Chapter10Functions/TailCallOptimization/TailCallOptimizationExample01.js: -------------------------------------------------------------------------------- 1 | function outerFunction() { 2 | return innerFunction(); // tail call 3 | } 4 | -------------------------------------------------------------------------------- /Chapter10Functions/UnderstandingArguments/ArgumentsInArrowFunctions/ArgumentsInArrowFunctionsExample02.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | let bar = () => { 3 | console.log(arguments[0]); // 5 4 | }; 5 | bar(); 6 | } 7 | 8 | foo(5); 9 | -------------------------------------------------------------------------------- /Chapter10Functions/UnderstandingArguments/UnderstandingArgumentsExample01.js: -------------------------------------------------------------------------------- 1 | function sayHi(name, message) { 2 | console.log("Hello " + name + ", " + message); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter10Functions/UnderstandingArguments/UnderstandingArgumentsExample02.js: -------------------------------------------------------------------------------- 1 | function sayHi() { 2 | console.log("Hello " + arguments[0] + ", " + arguments[1]); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter10Functions/UnderstandingArguments/UnderstandingArgumentsExample06.js: -------------------------------------------------------------------------------- 1 | function doAdd(num1, num2) { 2 | arguments[1] = 10; 3 | console.log(arguments[0] + num2); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/AsyncFunctions/AsyncFunctionBasics/TheAsyncKeyword/TheAsyncKeywordExample02.js: -------------------------------------------------------------------------------- 1 | async function foo() { 2 | console.log(1); 3 | } 4 | 5 | foo(); 6 | console.log(2); 7 | 8 | // 1 9 | // 2 10 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/AsyncFunctions/AsyncFunctionBasics/TheAwaitKeyword/TheAwaitKeywordExample01.js: -------------------------------------------------------------------------------- 1 | let p = new Promise((resolve, reject) => setTimeout(resolve, 1000, 3)); 2 | 3 | p.then((x) => console.log(x)); // 3 4 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/AsyncFunctions/AsyncFunctionsExample01.js: -------------------------------------------------------------------------------- 1 | let p = new Promise((resolve, reject) => setTimeout(resolve, 1000, 3)); 2 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/AsyncFunctions/AsyncFunctionsExample02.js: -------------------------------------------------------------------------------- 1 | let p = new Promise((resolve, reject) => setTimeout(resolve, 1000, 3)); 2 | 3 | p.then((x) => console.log(x)); // 3 4 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/AsyncFunctions/AsyncFunctionsExample03.js: -------------------------------------------------------------------------------- 1 | function handler(x) { console.log(x); } 2 | 3 | let p = new Promise((resolve, reject) => setTimeout(resolve, 1000, 3)); 4 | 5 | p.then(handler); // 3 6 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/IntroductionToAsynchronousProgramming/SynchronousVsAsynchronousJavaScript/SynchronousVsAsynchronousJavaScriptExample01.js: -------------------------------------------------------------------------------- 1 | let x = 3; 2 | x = x + 4; 3 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/IntroductionToAsynchronousProgramming/SynchronousVsAsynchronousJavaScript/SynchronousVsAsynchronousJavaScriptExample02.js: -------------------------------------------------------------------------------- 1 | let x = 3; 2 | setTimeout(() => x = x + 4, 1000); 3 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/Promises/PromiseBasics/PromiseBasicsExample01.js: -------------------------------------------------------------------------------- 1 | let p = new Promise(() => {}); 2 | setTimeout(console.log, 0, p); // Promise 3 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/Promises/PromiseBasics/PromiseCastingWithPromiseresolve/PromiseCastingWithPromiseresolveExample01.js: -------------------------------------------------------------------------------- 1 | let p1 = new Promise((resolve, reject) => resolve()); 2 | let p2 = Promise.resolve(); 3 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/Promises/PromiseBasics/PromiseRejectionWithPromisereject/PromiseRejectionWithPromiserejectExample01.js: -------------------------------------------------------------------------------- 1 | let p1 = new Promise((resolve, reject) => reject()); 2 | let p2 = Promise.reject(); 3 | -------------------------------------------------------------------------------- /Chapter11PromisesAndAsyncFunctions/Promises/PromiseInstanceMethods/ImplementingTheThenableInterface/ImplementingTheThenableInterfaceExample01.js: -------------------------------------------------------------------------------- 1 | class MyThenable { 2 | then() {} 3 | } 4 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheHistoryObject/HistoryStateManagement/HistoryStateManagementExample01.js: -------------------------------------------------------------------------------- 1 | let stateObject = {foo:"bar"}; 2 | 3 | history.pushState(stateObject, "My title", "baz.html"); 4 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheHistoryObject/HistoryStateManagement/HistoryStateManagementExample03.js: -------------------------------------------------------------------------------- 1 | history.replaceState({newFoo: "newBar"}, "New title"); 2 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheHistoryObject/Navigation/NavigationExample02.js: -------------------------------------------------------------------------------- 1 | // go to nearest wrox.com page 2 | history.go("wrox.com"); 3 | 4 | // go to nearest somewhere-else.com page 5 | history.go("somewhere-else.com"); 6 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheHistoryObject/Navigation/NavigationExample03.js: -------------------------------------------------------------------------------- 1 | // go back one page 2 | history.back(); 3 | 4 | // go forward one page 5 | history.forward(); 6 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheHistoryObject/Navigation/NavigationExample04.js: -------------------------------------------------------------------------------- 1 | if (history.length == 0){ 2 | //this is the first page in the user's window 3 | } 4 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheLocationObject/ManipulatingTheLocation/ManipulatingTheLocationExample01.js: -------------------------------------------------------------------------------- 1 | location.assign("http://www.wrox.com"); 2 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheLocationObject/ManipulatingTheLocation/ManipulatingTheLocationExample02.js: -------------------------------------------------------------------------------- 1 | window.location = "http://www.wrox.com"; 2 | location.href = "http://www.wrox.com"; 3 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheLocationObject/ManipulatingTheLocation/ManipulatingTheLocationExample05.js: -------------------------------------------------------------------------------- 1 | location.reload(); // reload - possibly from cache 2 | location.reload(true); // reload - go back to the server 3 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheNavigatorObject/RegisteringHandlers/RegisteringHandlersExample01.js: -------------------------------------------------------------------------------- 1 | navigator.registerProtocolHandler("mailto", 2 | "http://www.somemailclient.com?cmd=%s", 3 | "Some Mail Client"); 4 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/IntervalsAndTimeouts/IntervalsAndTimeoutsExample01.js: -------------------------------------------------------------------------------- 1 | // schedules an alert to show after 1 second 2 | setTimeout(() => alert("Hello world!"), 1000); 3 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/IntervalsAndTimeouts/IntervalsAndTimeoutsExample03.js: -------------------------------------------------------------------------------- 1 | 2 | setInterval(() => alert("Hello world!"), 10000); 3 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/NavigatingAndOpeningWindows/NavigatingAndOpeningWindowsExample01.js: -------------------------------------------------------------------------------- 1 | // same as 2 | window.open("http://www.wrox.com/", "topFrame"); 3 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/NavigatingAndOpeningWindows/PoppingUpWindows/PoppingUpWindowsExample03.js: -------------------------------------------------------------------------------- 1 | wroxWin.close(); 2 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/NavigatingAndOpeningWindows/PoppingUpWindows/PoppingUpWindowsExample04.js: -------------------------------------------------------------------------------- 1 | wroxWin.close(); 2 | alert(wroxWin.closed); // true 3 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/SystemDialogs/SystemDialogsExample01.js: -------------------------------------------------------------------------------- 1 | if (confirm("Are you sure?")) { 2 | alert("I'm so glad you're sure!"); 3 | } else { 4 | alert("I'm sorry to hear you're not sure."); 5 | } 6 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/SystemDialogs/SystemDialogsExample02.js: -------------------------------------------------------------------------------- 1 | let result = prompt("What is your name? ", ""); 2 | if (result !== null) { 3 | alert("Welcome, " + result); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter12TheBrowserObjectModel/TheWindowObject/SystemDialogs/SystemDialogsExample03.js: -------------------------------------------------------------------------------- 1 | // display print dialog 2 | window.print(); 3 | 4 | // display find dialog 5 | window.find(); 6 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/CapabilityDetection/CapabilityDetectionExample01.js: -------------------------------------------------------------------------------- 1 | if (object.propertyInQuestion) { 2 | // use object.propertyInQuestion 3 | } 4 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/CapabilityDetection/SaferCapabilityDetection/SaferCapabilityDetectionExample01.js: -------------------------------------------------------------------------------- 1 | // AVOID! Incorrect capability detection – only checks for existence 2 | function isSortable(object) { 3 | return !!object.sort; 4 | } 5 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/CapabilityDetection/SaferCapabilityDetection/SaferCapabilityDetectionExample02.js: -------------------------------------------------------------------------------- 1 | let result = isSortable({ sort: true }); 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/SoftwareAndHardwareDetection/BrowserMetadata/BatteryStatusAPI/BatteryStatusAPIExample01.js: -------------------------------------------------------------------------------- 1 | navigator.getBattery().then((b) => console.log(b)); 2 | // BatteryManager { ... } 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/SoftwareAndHardwareDetection/BrowserMetadata/TheGeolocationAPI/TheGeolocationAPIExample02.js: -------------------------------------------------------------------------------- 1 | console.log(p.timestamp); // 1525364883361 2 | console.log(p.coords); // Coordinates {...} 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/SoftwareAndHardwareDetection/BrowserMetadata/TheGeolocationAPI/TheGeolocationAPIExample04.js: -------------------------------------------------------------------------------- 1 | console.log(p.coords.altitude); // -8.800000190734863 2 | console.log(p.coords.altitudeAccuracy); // 200 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Chrome/ChromeExample02.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 2 | (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/EarlyBrowsers/EarlyBrowsersExample01.js: -------------------------------------------------------------------------------- 1 | Mosaic/0.9 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/EarlyBrowsers/EarlyBrowsersExample02.js: -------------------------------------------------------------------------------- 1 | Mozilla/Version [Language] (Platform; Encryption) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/EarlyBrowsers/EarlyBrowsersExample03.js: -------------------------------------------------------------------------------- 1 | Mozilla/2.02 [fr] (WinNT; I) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Gecko/GeckoExample02.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.4) Gecko/20011128 2 | Netscape6/6.2.1 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Gecko/GeckoExample03.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1b2) Gecko/20060823 SeaMonkey/1.1a 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Gecko/GeckoExample04.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 2 | Firefox/2.0.0.11 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Gecko/GeckoExample05.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.6) Gecko/20070809 2 | Camino/1.5.1 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Konqueror/KonquerorExample01.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (compatible; Konqueror/Version; OS-or-CPU) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Konqueror/KonquerorExample02.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (compatible; Konqueror/Version; OS-or-CPU) KHTML/KHTMLVersion 2 | (like Gecko) 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Konqueror/KonquerorExample03.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (compatible; Konqueror/3.5; SunOS) KHTML/3.5.0 (like Gecko) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeCommunicator4AndInternetExplorer4Through8/NetscapeCommunicator4AndInternetExplorer4Through8Example02.js: -------------------------------------------------------------------------------- 1 | Mozilla/4.0 (Win98; I) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeCommunicator4AndInternetExplorer4Through8/NetscapeCommunicator4AndInternetExplorer4Through8Example03.js: -------------------------------------------------------------------------------- 1 | Mozilla/4.79 (Win98; I) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeCommunicator4AndInternetExplorer4Through8/NetscapeCommunicator4AndInternetExplorer4Through8Example04.js: -------------------------------------------------------------------------------- 1 | Mozilla/4.0 (compatible; MSIE Version; Operating System) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeCommunicator4AndInternetExplorer4Through8/NetscapeCommunicator4AndInternetExplorer4Through8Example05.js: -------------------------------------------------------------------------------- 1 | Mozilla/4.0 (compatible; MSIE 4.0; Windows 98) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeCommunicator4AndInternetExplorer4Through8/NetscapeCommunicator4AndInternetExplorer4Through8Example06.js: -------------------------------------------------------------------------------- 1 | Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeCommunicator4AndInternetExplorer4Through8/NetscapeCommunicator4AndInternetExplorer4Through8Example07.js: -------------------------------------------------------------------------------- 1 | Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeNavigator3AndInternetExplorer3/NetscapeNavigator3AndInternetExplorer3Example01.js: -------------------------------------------------------------------------------- 1 | Mozilla/Version (Platform; Encryption [; OS-or-CPU description]) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/NetscapeNavigator3AndInternetExplorer3/NetscapeNavigator3AndInternetExplorer3Example02.js: -------------------------------------------------------------------------------- 1 | Mozilla/3.0 (Win95; U) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Opera/OperaExample01.js: -------------------------------------------------------------------------------- 1 | Opera/Version (OS-or-CPU; Encryption) [Language] 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Opera/OperaExample02.js: -------------------------------------------------------------------------------- 1 | Opera/7.54 (Windows NT 5.1; U) [en] 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Opera/OperaExample03.js: -------------------------------------------------------------------------------- 1 | Opera/Version (OS-or-CPU; Encryption; Language) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Opera/OperaExample04.js: -------------------------------------------------------------------------------- 1 | Opera/8.0 (Windows NT 5.1; U; en) 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Opera/OperaExample06.js: -------------------------------------------------------------------------------- 1 | Opera/9.80 (OS-or-CPU; Encryption; Language) Presto/PrestoVersion Version/Version 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/Opera/OperaExample07.js: -------------------------------------------------------------------------------- 1 | Opera/9.80 (Windows NT 6.1; U; en) Presto/2.6.30 Version/10.63 2 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/WebKit/WebKitExample01.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Platform; Encryption; OS-or-CPU; Language) 2 | AppleWebKit/AppleWebKitVersion (KHTML, like Gecko) Safari/SafariVersion 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/WebKit/WebKitExample02.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko) 2 | Safari/125.1 3 | -------------------------------------------------------------------------------- /Chapter13ClientDetection/UserAgentDetection/HistoryOfUserAgentComposition/WebKit/WebKitExample03.js: -------------------------------------------------------------------------------- 1 | Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/522.15.5 2 | (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5 3 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/HierarchyOfNodesExample01.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample Page 4 | 5 | 6 |

Hello World!

7 | 8 | 9 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheCDATASectionType/TheCDATASectionTypeExample01.js: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheCommentType/TheCommentTypeExample01.js: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheCommentType/TheCommentTypeExample02.js: -------------------------------------------------------------------------------- 1 | let div = document.getElementById("myDiv"); 2 | let comment = div.firstChild; 3 | alert(comment.data); // "A comment" 4 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheCommentType/TheCommentTypeExample03.js: -------------------------------------------------------------------------------- 1 | let comment = document.createComment("A comment"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentFragmentType/TheDocumentFragmentTypeExample01.js: -------------------------------------------------------------------------------- 1 | let fragment = document.createDocumentFragment(); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentFragmentType/TheDocumentFragmentTypeExample02.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/DOMConformanceDetection/DOMConformanceDetectionExample01.js: -------------------------------------------------------------------------------- 1 | let hasXmlDom = document.implementation.hasFeature("XML", "1.0"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/DocumentChildren/DocumentChildrenExample01.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/DocumentChildren/DocumentChildrenExample03.js: -------------------------------------------------------------------------------- 1 | let body = document.body; // get reference to 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/DocumentChildren/DocumentChildrenExample04.js: -------------------------------------------------------------------------------- 1 | let doctype = document.doctype; // get reference to 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/DocumentChildren/DocumentChildrenExample05.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample01.js: -------------------------------------------------------------------------------- 1 |
Some text
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample02.html: -------------------------------------------------------------------------------- 1 | let div = document.getElementById("myDiv"); // retrieve reference to the
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample03.js: -------------------------------------------------------------------------------- 1 | let div = document.getElementById("mydiv"); // null 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample04.js: -------------------------------------------------------------------------------- 1 | let images = document.getElementsByTagName("img"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample06.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample07.js: -------------------------------------------------------------------------------- 1 | let myImage = images.namedItem("myImage"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample08.js: -------------------------------------------------------------------------------- 1 | let myImage = images["myImage"]; 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample09.js: -------------------------------------------------------------------------------- 1 | let allElements = document.getElementsByTagName("*"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentType/LocatingElements/LocatingElementsExample11.js: -------------------------------------------------------------------------------- 1 | let radios = document.getElementsByName("color"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheDocumentTypeType/TheDocumentTypeTypeExample01.js: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/CreatingElements/CreatingElementsExample01.js: -------------------------------------------------------------------------------- 1 | let div = document.createElement("div"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/CreatingElements/CreatingElementsExample02.js: -------------------------------------------------------------------------------- 1 | div.id = "myNewDiv"; 2 | div.className = "box"; 3 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/CreatingElements/CreatingElementsExample03.js: -------------------------------------------------------------------------------- 1 | document.body.appendChild(div); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/ElementChildren/ElementChildrenExample01.js: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/ElementChildren/ElementChildrenExample02.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/ElementChildren/ElementChildrenExample04.js: -------------------------------------------------------------------------------- 1 | let ul = document.getElementById("myList"); 2 | let items = ul.getElementsByTagName("li"); 3 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/GettingAttributes/GettingAttributesExample02.js: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/GettingAttributes/GettingAttributesExample03.js: -------------------------------------------------------------------------------- 1 | let value = div.getAttribute("my_special_attribute"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/GettingAttributes/GettingAttributesExample04.js: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/HTMLElements/HTMLElementsExample01.js: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/HTMLElements/HTMLElementsExample03.js: -------------------------------------------------------------------------------- 1 | div.id = "someOtherId"; 2 | div.className = "ft"; 3 | div.title = "Some other text"; 4 | div.lang = "fr"; 5 | div.dir ="rtl"; 6 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/SettingAttributes/SettingAttributesExample02.js: -------------------------------------------------------------------------------- 1 | div.id = "someOtherId"; 2 | div.align = "left"; 3 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/SettingAttributes/SettingAttributesExample03.js: -------------------------------------------------------------------------------- 1 | div.mycolor = "red"; 2 | alert(div.getAttribute("mycolor")); // null (except in Internet Explorer) 3 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/SettingAttributes/SettingAttributesExample04.js: -------------------------------------------------------------------------------- 1 | div.removeAttribute("class"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/TheAttributesProperty/TheAttributesPropertyExample01.js: -------------------------------------------------------------------------------- 1 | let id = element.attributes.getNamedItem("id").nodeValue; 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/TheAttributesProperty/TheAttributesPropertyExample02.js: -------------------------------------------------------------------------------- 1 | let id = element.attributes["id"].nodeValue; 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/TheAttributesProperty/TheAttributesPropertyExample03.js: -------------------------------------------------------------------------------- 1 | element.attributes["id"].nodeValue = "someOtherId"; 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/TheAttributesProperty/TheAttributesPropertyExample04.js: -------------------------------------------------------------------------------- 1 | let oldAttr = element.attributes.removeNamedItem("id"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/TheAttributesProperty/TheAttributesPropertyExample05.js: -------------------------------------------------------------------------------- 1 | element.attributes.setNamedItem(newAttr); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/TheElementTypeExample01.js: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheElementType/TheElementTypeExample02.js: -------------------------------------------------------------------------------- 1 | let div = document.getElementById("myDiv"); 2 | alert(div.tagName); // "DIV" 3 | alert(div.tagName == div.nodeName); // true 4 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheNodeType/NodeRelationships/NodeRelationshipsExample01.js: -------------------------------------------------------------------------------- 1 | let firstChild = someNode.childNodes[0]; 2 | let secondChild = someNode.childNodes.item(1); 3 | let count = someNode.childNodes.length; 4 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheNodeType/NodeRelationships/NodeRelationshipsExample02.js: -------------------------------------------------------------------------------- 1 | let arrayOfNodes = Array.prototype.slice.call(someNode.childNodes,0); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheNodeType/OtherMethods/OtherMethodsExample01.js: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheNodeType/TheNodeTypeExample01.js: -------------------------------------------------------------------------------- 1 | if (someNode.nodeType == Node.ELEMENT_NODE){ 2 | alert("Node is an element."); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheNodeType/TheNodenameAndNodevalueProperties/TheNodenameAndNodevaluePropertiesExample01.js: -------------------------------------------------------------------------------- 1 | if (someNode.nodeType == 1){ 2 | value = someNode.nodeName; // will be the element's tag name 3 | } 4 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheTextType/CreatingTextNodes/CreatingTextNodesExample01.js: -------------------------------------------------------------------------------- 1 | let textNode = document.createTextNode("Hello world!"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheTextType/TheTextTypeExample02.js: -------------------------------------------------------------------------------- 1 | let textNode = div.firstChild; // or div.childNodes[0] 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheTextType/TheTextTypeExample03.js: -------------------------------------------------------------------------------- 1 | div.firstChild.nodeValue = "Some other message"; 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/HierarchyOfNodes/TheTextType/TheTextTypeExample04.js: -------------------------------------------------------------------------------- 1 | // outputs as "Some <strong>other</strong> message" 2 | div.firstChild.nodeValue = "Some other message"; 3 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicScripts/DynamicScriptsExample01.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicScripts/DynamicScriptsExample02.js: -------------------------------------------------------------------------------- 1 | let script = document.createElement("script"); 2 | script.src = "foo.js"; 3 | document.body.appendChild(script); 4 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicScripts/DynamicScriptsExample03.js: -------------------------------------------------------------------------------- 1 | function loadScript(url) { 2 | let script = document.createElement("script"); 3 | script.src = url; 4 | document.body.appendChild(script); 5 | } 6 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicScripts/DynamicScriptsExample04.js: -------------------------------------------------------------------------------- 1 | loadScript("client.js"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicScripts/DynamicScriptsExample05.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicScripts/DynamicScriptsExample07.js: -------------------------------------------------------------------------------- 1 | var script = document.createElement("script"); 2 | script.text = "function sayHi(){alert('hi');}"; 3 | document.body.appendChild(script); 4 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicScripts/DynamicScriptsExample10.js: -------------------------------------------------------------------------------- 1 | loadScriptString("function sayHi(){alert('hi');}"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicStyles/DynamicStylesExample01.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicStyles/DynamicStylesExample04.js: -------------------------------------------------------------------------------- 1 | loadStyles("styles.css"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicStyles/DynamicStylesExample05.js: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/DynamicStyles/DynamicStylesExample09.js: -------------------------------------------------------------------------------- 1 | loadStyleString("body{background-color:red}"); 2 | -------------------------------------------------------------------------------- /Chapter14TheDocumentObjectModel/WorkingWithTheDOM/UsingNodeLists/UsingNodeListsExample02.js: -------------------------------------------------------------------------------- 1 | for (let div of document.getElementsByTagName("div")){ 2 | let newDiv = document.createElement("div"); 3 | document.body.appendChild(newDiv); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/ChangesToHTMLDocument/CompatibilityMode/CompatibilityModeExample01.js: -------------------------------------------------------------------------------- 1 | if (document.compatMode == "CSS1Compat"){ 2 | alert("Standards mode"); 3 | } else { 4 | alert("Quirks mode"); 5 | } 6 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/ClassRelatedAdditions/TheClasslistProperty/TheClasslistPropertyExample01.js: -------------------------------------------------------------------------------- 1 |
...
2 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/ClassRelatedAdditions/TheClasslistProperty/TheClasslistPropertyExample03.js: -------------------------------------------------------------------------------- 1 | div.classList.remove("user"); 2 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/CustomDataAttributes/CustomDataAttributesExample01.js: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/FocusManagement/FocusManagementExample01.js: -------------------------------------------------------------------------------- 1 | let button = document.getElementById("myButton"); 2 | button.focus(); 3 | alert(document.activeElement === button); // true 4 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/FocusManagement/FocusManagementExample02.js: -------------------------------------------------------------------------------- 1 | let button = document.getElementById("myButton"); 2 | button.focus(); 3 | alert(document.hasFocus()); // true 4 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/MemoryAndPerformanceIssues/MemoryAndPerformanceIssuesExample01.js: -------------------------------------------------------------------------------- 1 | for (let value of values){ 2 | ul.innerHTML += `
  • ${value}
  • `; // avoid!! 3 | } 4 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/MemoryAndPerformanceIssues/MemoryAndPerformanceIssuesExample02.js: -------------------------------------------------------------------------------- 1 | let itemsHtml = ""; 2 | for (let value of values){ 3 | itemsHtml += `
  • ${value}
  • `; 4 | } 5 | ul.innerHTML = itemsHtml; 6 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/TheInnerhtmlProperty/TheInnerhtmlPropertyExample03.js: -------------------------------------------------------------------------------- 1 | div.innerHTML = "Hello world!"; 2 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/TheInnerhtmlProperty/TheInnerhtmlPropertyExample04.js: -------------------------------------------------------------------------------- 1 | div.innerHTML = "Hello & welcome, \"reader\"!"; 2 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/TheInnerhtmlProperty/TheInnerhtmlPropertyExample05.js: -------------------------------------------------------------------------------- 1 |
    Hello & welcome, "reader"!
    2 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/TheOuterhtmlProperty/TheOuterhtmlPropertyExample02.html: -------------------------------------------------------------------------------- 1 | div.outerHTML = "

    This is a paragraph.

    "; 2 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/TheOuterhtmlProperty/TheOuterhtmlPropertyExample03.js: -------------------------------------------------------------------------------- 1 | let p = document.createElement("p"); 2 | p.appendChild(document.createTextNode("This is a paragraph.")); 3 | div.parentNode.replaceChild(p, div); 4 | -------------------------------------------------------------------------------- /Chapter15DOMExtensions/HTML5/MarkupInsertion/UsingInnerhtmlInLegacyInternetExplorer/UsingInnerhtmlInLegacyInternetExplorerExample01.html: -------------------------------------------------------------------------------- 1 | // Won't work 2 | div.innerHTML = " 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter26Modules/ImprovisingModuleSystems/ImprovisingModuleSystemsExample01.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | // private Foo module code 3 | console.log('bar'); 4 | })(); 5 | 6 | // 'bar' 7 | -------------------------------------------------------------------------------- /Chapter26Modules/ImprovisingModuleSystems/ImprovisingModuleSystemsExample02.js: -------------------------------------------------------------------------------- 1 | var Foo = (function() { 2 | console.log('bar'); 3 | })(); 4 | 5 | 'bar' 6 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample01.js: -------------------------------------------------------------------------------- 1 | var moduleB = require('./moduleB'); 2 | 3 | module.exports = { 4 | stuff: moduleB.doStuff(); 5 | }; 6 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample02.js: -------------------------------------------------------------------------------- 1 | console.log('moduleA'); 2 | require('./moduleA'); // "moduleA" 3 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample03.js: -------------------------------------------------------------------------------- 1 | console.log('moduleA'); 2 | var a1 = require('./moduleA'); 3 | var a2 = require('./moduleA'); 4 | 5 | console.log(a1 === a2); // true 6 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample04.js: -------------------------------------------------------------------------------- 1 | console.log('moduleA'); 2 | require('./moduleA'); 3 | require('./moduleB'); // "moduleA" 4 | require('./moduleA'); 5 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample05.js: -------------------------------------------------------------------------------- 1 | console.log('moduleA'); 2 | if (loadCondition) { 3 | require('./moduleA'); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample06.js: -------------------------------------------------------------------------------- 1 | var moduleA = require('./moduleA'); 2 | 3 | console.log(moduleA.stuff); 4 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample07.js: -------------------------------------------------------------------------------- 1 | module.exports = 'foo'; 2 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample08.js: -------------------------------------------------------------------------------- 1 | var moduleA = require('./moduleB'); 2 | 3 | console.log(moduleB); // 'foo' 4 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample09.js: -------------------------------------------------------------------------------- 1 | // Equivalent: 2 | 3 | module.exports = { 4 | a: 'A', 5 | b: 'B' 6 | }; 7 | 8 | module.exports.a = 'A'; 9 | module.exports.b = 'B'; 10 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample10.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | 3 | module.exports = A; 4 | var A = require('./moduleA'); 5 | 6 | var a = new A(); 7 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample11.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | 3 | module.exports = new A(); 4 | -------------------------------------------------------------------------------- /Chapter26Modules/PreES6ModuleLoaders/CommonJS/CommonJSExample12.js: -------------------------------------------------------------------------------- 1 | 2 | if (condition) { 3 | var A = require('./moduleA'); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter26Modules/TheModulePattern/AsynchronousDependencies/AsynchronousDependenciesExample01.js: -------------------------------------------------------------------------------- 1 | // moduleA definition 2 | load('moduleB').then(function(moduleB) { 3 | moduleB.doStuff(); 4 | }); 5 | -------------------------------------------------------------------------------- /Chapter26Modules/TheModulePattern/CircularDependencies/CircularDependenciesExample02.js: -------------------------------------------------------------------------------- 1 | moduleB 2 | moduleC 3 | moduleD 4 | moduleA 5 | -------------------------------------------------------------------------------- /Chapter26Modules/TheModulePattern/CircularDependencies/CircularDependenciesExample03.js: -------------------------------------------------------------------------------- 1 | moduleD 2 | moduleA 3 | moduleB 4 | moduleC 5 | -------------------------------------------------------------------------------- /Chapter26Modules/TheModulePattern/ProgrammaticDependencies/ProgrammaticDependenciesExample01.js: -------------------------------------------------------------------------------- 1 | if (loadCondition) { 2 | require('./moduleA'); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/InterceptingAFetchEvent/ReturnFromNetwork/ReturnFromNetworkExample01.js: -------------------------------------------------------------------------------- 1 | self.onfetch = (fetchEvent) => { 2 | fetchEvent.respondWith(fetch(fetchEvent.requeest)); 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/ManagingServiceWorkerFileCachingWithUpdateviacache/ManagingServiceWorkerFileCachingWithUpdateviacacheExample01.js: -------------------------------------------------------------------------------- 1 | navigator.serviceWorker.register('/serviceWorker.js', { 2 | updateViaCache: 'none' 3 | }); 4 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/PushNotifications/DisplayingNotifications/DisplayingNotificationsExample02.js: -------------------------------------------------------------------------------- 1 | self.onactivate = () => self.registration.showNotification('bar'); 2 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/PushNotifications/HandlingPushEvents/HandlingPushEventsExample01.js: -------------------------------------------------------------------------------- 1 | self.onpush = (pushEvent) => { 2 | console.log('Service worker was pushed data:', pushEvent.data.text()); 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/ServiceWorkerBasics/CreatingAServiceWorker/CreatingAServiceWorkerExample01.js: -------------------------------------------------------------------------------- 1 | // empty service worker script 2 | 3 | main.js 4 | navigator.serviceWorker.register('./emptyServiceWorker.js'); 5 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/ServiceWorkerBasics/ServiceWorkerScopeLimitations/ServiceWorkerScopeLimitationsExample06.js: -------------------------------------------------------------------------------- 1 | navigator.serviceWorker.register('/serviceWorker.js', {scope: '/foo/'}) 2 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/ServiceWorkerBasics/UsingTheServiceWorkerContainerObject/UsingTheServiceWorkerContainerObjectExample01.js: -------------------------------------------------------------------------------- 1 | console.log(navigator.serviceWorker); 2 | 3 | // ServiceWorkerContainer { ... } 4 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/TheServiceWorkerCache/TheCacheStorageObject/TheCacheStorageObjectExample01.js: -------------------------------------------------------------------------------- 1 | console.log(caches); // CacheStorage {} 2 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/TheServiceWorkerCache/TheCacheStorageObject/TheCacheStorageObjectExample02.js: -------------------------------------------------------------------------------- 1 | caches.open('v1').then(console.log); 2 | 3 | // Cache {} 4 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/UnderstandingTheServiceWorkerLifecycle/TheActivatingState/TheActivatingStateExample02.js: -------------------------------------------------------------------------------- 1 | self.oninstall = (activateEvent) => { 2 | console.log('Service worker is in the activating state'); 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter27Workers/ServiceWorkers/UnderstandingTheServiceWorkerLifecycle/TheInstallingState/TheInstallingStateExample03.js: -------------------------------------------------------------------------------- 1 | self.oninstall = (installEvent) => { 2 | console.log('Service worker is in the installing state'); 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter27Workers/SharedWorkers/SharedWorkerBasics/CreatingASharedWorker/CreatingASharedWorkerExample02.js: -------------------------------------------------------------------------------- 1 | const worker = new Worker('./emptyWorker.js'); 2 | console.log(worker); // Worker {} 3 | -------------------------------------------------------------------------------- /Chapter27Workers/SharedWorkers/UnderstandingTheSharedWorkerLifecycle/UnderstandingTheSharedWorkerLifecycleExample01.js: -------------------------------------------------------------------------------- 1 | new Worker('./worker.js'); 2 | -------------------------------------------------------------------------------- /Chapter27Workers/SharedWorkers/UnderstandingTheSharedWorkerLifecycle/UnderstandingTheSharedWorkerLifecycleExample02.js: -------------------------------------------------------------------------------- 1 | new SharedWorker('./sharedWorker.js'); 2 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Deployment/BuildProcess/TreeShaking/TreeShakingExample01.js: -------------------------------------------------------------------------------- 1 | import { foo } from './utils.js'; 2 | 3 | console.log(foo); 4 | export const foo = 'foo'; 5 | export const bar = 'bar'; // unused 6 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Maintainability/LooseCoupling/DecoupleCSSJavaScript/DecoupleCSSJavaScriptExample01.js: -------------------------------------------------------------------------------- 1 | // tight coupling of CSS to JavaScript 2 | element.style.color = "red"; 3 | element.style.backgroundColor = "blue"; 4 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Maintainability/LooseCoupling/DecoupleCSSJavaScript/DecoupleCSSJavaScriptExample02.js: -------------------------------------------------------------------------------- 1 | // loose coupling of CSS to JavaScript 2 | element.className = "edit"; 3 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Maintainability/ProgrammingPractices/AvoidGlobals/AvoidGlobalsExample01.js: -------------------------------------------------------------------------------- 1 | // two globals - AVOID!!! 2 | var name = "Nicholas"; 3 | function sayName() { 4 | console.log(name); 5 | } 6 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Maintainability/ProgrammingPractices/AvoidNullComparisons/AvoidNullComparisonsExample01.js: -------------------------------------------------------------------------------- 1 | function sortArray(values) { 2 | if (values != null) { // AVOID!! 3 | values.sort(comparator); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Maintainability/ProgrammingPractices/AvoidNullComparisons/AvoidNullComparisonsExample02.js: -------------------------------------------------------------------------------- 1 | function sortArray(values) { 2 | if (values instanceof Array) { // preferred 3 | values.sort(comparator); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Maintainability/ProgrammingPractices/RespectObjectOwnership/RespectObjectOwnershipExample01.js: -------------------------------------------------------------------------------- 1 | document.getElementsByClassName("selected").each(Element.hide); 2 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/BeScopeAware/AvoidTheWithStatement/AvoidTheWithStatementExample01.js: -------------------------------------------------------------------------------- 1 | function updateBody() { 2 | with(document.body) { 3 | console.log(tagName); 4 | innerHTML = "Hello world!"; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/BeScopeAware/AvoidTheWithStatement/AvoidTheWithStatementExample02.js: -------------------------------------------------------------------------------- 1 | function updateBody() { 2 | let body = document.body; 3 | console.log(body.tagName); 4 | body.innerHTML = "Hello world!"; 5 | } 6 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/AvoidUnnecessaryPropertyLookup/AvoidUnnecessaryPropertyLookupExample01.js: -------------------------------------------------------------------------------- 1 | let value = 5; 2 | let sum = 10 + value; 3 | console.log(sum); 4 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/AvoidUnnecessaryPropertyLookup/AvoidUnnecessaryPropertyLookupExample02.js: -------------------------------------------------------------------------------- 1 | let values = [5, 10]; 2 | let sum = values[0] + values[1]; 3 | console.log(sum); 4 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/AvoidUnnecessaryPropertyLookup/AvoidUnnecessaryPropertyLookupExample03.js: -------------------------------------------------------------------------------- 1 | let values = { first: 5, second: 10 }; 2 | let sum = values.first + values.second; 3 | console.log(sum); 4 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/AvoidUnnecessaryPropertyLookup/AvoidUnnecessaryPropertyLookupExample04.js: -------------------------------------------------------------------------------- 1 | let query = window.location.href.substring(window.location.href.indexOf("?")); 2 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/AvoidUnnecessaryPropertyLookup/AvoidUnnecessaryPropertyLookupExample05.js: -------------------------------------------------------------------------------- 1 | let url = window.location.href; 2 | let query = url.substring(url.indexOf("?")); 3 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/OptimizeLoops/OptimizeLoopsExample01.js: -------------------------------------------------------------------------------- 1 | for (let i = 0; i < values.length; i++) { 2 | process(values[i]); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/OptimizeLoops/OptimizeLoopsExample02.js: -------------------------------------------------------------------------------- 1 | for (let i = values.length - 1; i >= 0; i--) { 2 | process(values[i]); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/OptimizeLoops/OptimizeLoopsExample03.js: -------------------------------------------------------------------------------- 1 | let i = values.length-1; 2 | if (i > -1) { 3 | do { 4 | process(values[i]); 5 | }while(--i >= 0); 6 | } 7 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/ChooseTheRightApproach/UnrollingLoops/UnrollingLoopsExample01.js: -------------------------------------------------------------------------------- 1 | // eliminated the loop 2 | process(values[0]); 3 | process(values[1]); 4 | process(values[2]); 5 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/MinimizeStatementCount/InsertIterativeValues/InsertIterativeValuesExample01.js: -------------------------------------------------------------------------------- 1 | let name = values[i]; 2 | i++; 3 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/MinimizeStatementCount/InsertIterativeValues/InsertIterativeValuesExample02.js: -------------------------------------------------------------------------------- 1 | let name = values[i++]; 2 | -------------------------------------------------------------------------------- /Chapter28BestPractices/Performance/MinimizeStatementCount/MultipleVariableDeclarations/MultipleVariableDeclarationsExample02.js: -------------------------------------------------------------------------------- 1 | // one statement 2 | let count = 5, 3 | color = "blue", 4 | values = [1,2,3], 5 | now = new Date(); 6 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/DeprecatedSyntax/DeprecatedSyntaxExample01.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/DynamicScriptLoading/DynamicScriptLoadingExample01.js: -------------------------------------------------------------------------------- 1 | let script = document.createElement('script'); 2 | script.src = 'gibberish.js'; 3 | document.head.appendChild(script); 4 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/DynamicScriptLoading/DynamicScriptLoadingExample02.js: -------------------------------------------------------------------------------- 1 | let script = document.createElement('script'); 2 | script.src = 'gibberish.js'; 3 | script.async = false; 4 | document.head.appendChild(script); 5 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/TheScriptElementExample01.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/TheScriptElementExample02.html: -------------------------------------------------------------------------------- 1 | 2 | function sayScript() { 3 | console.log(""); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/TheScriptElementExample03.html: -------------------------------------------------------------------------------- 1 | 2 | function sayScript() { 3 | console.log("<\/script>"); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/TheScriptElementExample04.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Chapter2JavaScriptInHTML/TheScriptElement/TheScriptElementExample05.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheBooleanType/TheBooleanTypeExample01.js: -------------------------------------------------------------------------------- 1 | let found = true; 2 | let lost = false; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheBooleanType/TheBooleanTypeExample02.js: -------------------------------------------------------------------------------- 1 | let message = "Hello world!"; 2 | let messageAsBoolean = Boolean(message); 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheBooleanType/TheBooleanTypeExample03.js: -------------------------------------------------------------------------------- 1 | let message = "Hello world!"; 2 | if (message) { 3 | console.log("Value is true"); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNullType/TheNullTypeExample01.js: -------------------------------------------------------------------------------- 1 | let car = null; 2 | console.log(typeof car); // "object" 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNullType/TheNullTypeExample02.js: -------------------------------------------------------------------------------- 1 | if (car != null) { 2 | // do something with car 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNullType/TheNullTypeExample03.js: -------------------------------------------------------------------------------- 1 | console.log(null == undefined); // true 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/FloatingPointValues/FloatingPointValuesExample01.js: -------------------------------------------------------------------------------- 1 | let floatNum1 = 1.1; 2 | let floatNum2 = 0.1; 3 | let floatNum3 = .1; // valid, but not recommended 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/FloatingPointValues/FloatingPointValuesExample03.js: -------------------------------------------------------------------------------- 1 | let floatNum = 3.125e7; // equal to 31250000 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/FloatingPointValues/FloatingPointValuesExample04.js: -------------------------------------------------------------------------------- 1 | if (a + b == 0.3) { // avoid! 2 | console.log("You got 0.3."); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/NaN/NaNExample01.js: -------------------------------------------------------------------------------- 1 | console.log(NaN == NaN); // false 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/NumberConversions/NumberConversionsExample03.js: -------------------------------------------------------------------------------- 1 | let num = parseInt("0xAF", 16); // 175 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/NumberConversions/NumberConversionsExample04.js: -------------------------------------------------------------------------------- 1 | let num1 = parseInt("AF", 16); // 175 2 | let num2 = parseInt("AF"); // NaN 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/RangeOfValues/RangeOfValuesExample01.js: -------------------------------------------------------------------------------- 1 | let result = Number.MAX_VALUE + Number.MAX_VALUE; 2 | console.log(isFinite(result)); // false 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/TheNumberTypeExample01.js: -------------------------------------------------------------------------------- 1 | let intNum = 55; // integer 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/TheNumberTypeExample02.js: -------------------------------------------------------------------------------- 1 | let octalNum1 = 070; // octal for 56 2 | let octalNum2 = 079; // invalid octal - interpreted as 79 3 | let octalNum3 = 08; // invalid octal - interpreted as 8 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheNumberType/TheNumberTypeExample03.js: -------------------------------------------------------------------------------- 1 | let hexNum1 = 0xA; // hexadecimal for 10 2 | let hexNum2 = 0x1f; // hexadecimal for 31 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheObjectType/TheObjectTypeExample01.js: -------------------------------------------------------------------------------- 1 | let o = new Object(); 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheObjectType/TheObjectTypeExample02.js: -------------------------------------------------------------------------------- 1 | let o = new Object; // legal, but not recommended 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheStringType/CharacterLiterals/CharacterLiteralsExample01.js: -------------------------------------------------------------------------------- 1 | let text = "This is the letter sigma: \u03a3."; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheStringType/CharacterLiterals/CharacterLiteralsExample02.js: -------------------------------------------------------------------------------- 1 | console.log(text.length); // 28 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheStringType/Interpolation/InterpolationExample02.js: -------------------------------------------------------------------------------- 1 | console.log(`Hello, ${ `World` }!`); // Hello, World! 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheStringType/Interpolation/InterpolationExample03.js: -------------------------------------------------------------------------------- 1 | let foo = { toString: () => 'World' }; 2 | console.log(`Hello, ${ foo }!`); // Hello, World! 3 | 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheStringType/TemplateLiterals/TemplateLiteralsExample02.html: -------------------------------------------------------------------------------- 1 | let pageHTML = ` 2 |
    3 | 4 | Jake 5 | 6 |
    `; 7 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheStringType/TheNatureOfStrings/TheNatureOfStringsExample01.js: -------------------------------------------------------------------------------- 1 | let lang = "Java"; 2 | lang = lang + "Script"; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheStringType/TheStringTypeExample01.js: -------------------------------------------------------------------------------- 1 | let firstName = "John"; 2 | let lastName = 'Jacob'; 3 | let lastName = `Jingleheimerschmidt` 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheSymbolType/BasicSymbolUse/BasicSymbolUseExample01.js: -------------------------------------------------------------------------------- 1 | let sym = Symbol(); 2 | console.log(typeof sym); // symbol 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheSymbolType/UsingTheGlobalSymbolRegistry/UsingTheGlobalSymbolRegistryExample01.js: -------------------------------------------------------------------------------- 1 | let fooGlobalSymbol = Symbol.for('foo'); 2 | console.log(typeof fooGlobalSymbol); // "object" 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheSymbolType/UsingTheGlobalSymbolRegistry/UsingTheGlobalSymbolRegistryExample04.js: -------------------------------------------------------------------------------- 1 | let emptyGlobalSymbol = Symbol.for(); 2 | console.log(emptyGlobalSymbol); // Symbol(undefined) 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheUndefinedType/TheUndefinedTypeExample01.js: -------------------------------------------------------------------------------- 1 | let message; 2 | console.log(message == undefined); // true 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/DataTypes/TheUndefinedType/TheUndefinedTypeExample02.js: -------------------------------------------------------------------------------- 1 | let message = undefined; 2 | console.log(message == undefined); // true 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample01.js: -------------------------------------------------------------------------------- 1 | function functionName(arg0, arg1,...,argN) { 2 | statements 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample02.js: -------------------------------------------------------------------------------- 1 | function sayHi(name, message) { 2 | console.log("Hello " + name + ", " + message); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample03.js: -------------------------------------------------------------------------------- 1 | sayHi("Nicholas", "how are you today?"); 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample04.js: -------------------------------------------------------------------------------- 1 | function sum(num1, num2) { 2 | return num1 + num2; 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample05.js: -------------------------------------------------------------------------------- 1 | const result = sum(5, 10); 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample06.js: -------------------------------------------------------------------------------- 1 | function sum(num1, num2) { 2 | return num1 + num2; 3 | console.log("Hello world"); // never executed 4 | } 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample07.js: -------------------------------------------------------------------------------- 1 | function diff(num1, num2) { 2 | if (num1 < num2) { 3 | return num2 - num1; 4 | } else { 5 | return num1 - num2; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Functions/FunctionsExample08.js: -------------------------------------------------------------------------------- 1 | function sayHi(name, message) { 2 | return; 3 | console.log("Hello " + name + ", " + message); // never called 4 | } 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/AdditiveOperators/Add/AddExample01.js: -------------------------------------------------------------------------------- 1 | let result = 1 + 2; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/AdditiveOperators/Add/AddExample03.js: -------------------------------------------------------------------------------- 1 | let num1 = 5; 2 | let num2 = 10; 3 | let message = "The sum of 5 and 10 is " + num1 + num2; 4 | console.log(message); // "The sum of 5 and 10 is 510" 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/AdditiveOperators/Add/AddExample04.js: -------------------------------------------------------------------------------- 1 | let num1 = 5; 2 | let num2 = 10; 3 | let message = "The sum of 5 and 10 is " + (num1 + num2); 4 | console.log(message); // "The sum of 5 and 10 is 15" 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/AdditiveOperators/Subtract/SubtractExample01.js: -------------------------------------------------------------------------------- 1 | let result = 2 - 1; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/AssignmentOperators/AssignmentOperatorsExample01.js: -------------------------------------------------------------------------------- 1 | let num = 10; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/AssignmentOperators/AssignmentOperatorsExample02.js: -------------------------------------------------------------------------------- 1 | let num = 10; 2 | num = num + 10; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/AssignmentOperators/AssignmentOperatorsExample03.js: -------------------------------------------------------------------------------- 1 | let num = 10; 2 | num += 10; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseAND/BitwiseANDExample01.js: -------------------------------------------------------------------------------- 1 | let result = 25 & 3; 2 | console.log(result); // 1 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseNOT/BitwiseNOTExample02.js: -------------------------------------------------------------------------------- 1 | let num1 = 25; 2 | let num2 = -num1 - 1; 3 | console.log(num2); // "-26" 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseOR/BitwiseORExample01.js: -------------------------------------------------------------------------------- 1 | let result = 25 | 3; 2 | console.log(result); // 27 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseOperatorsExample01.js: -------------------------------------------------------------------------------- 1 | 0000 0000 0000 0000 0000 0000 0001 0010 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseOperatorsExample02.js: -------------------------------------------------------------------------------- 1 | 1111 1111 1111 1111 1111 1111 1110 1101 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseOperatorsExample03.js: -------------------------------------------------------------------------------- 1 | 1111 1111 1111 1111 1111 1111 1110 1101 2 | 1 3 | --------------------------------------- 4 | 1111 1111 1111 1111 1111 1111 1110 1110 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseOperatorsExample04.js: -------------------------------------------------------------------------------- 1 | let num = -18; 2 | console.log(num.toString(2)); // "-10010" 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/BitwiseXOR/BitwiseXORExample01.js: -------------------------------------------------------------------------------- 1 | let result = 25 ^ 3; 2 | console.log(result); // 26 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/LeftShift/LeftShiftExample01.js: -------------------------------------------------------------------------------- 1 | let oldValue = 2; // equal to binary 10 2 | let newValue = oldValue << 5; // equal to binary 1000000 which is decimal 64 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/SignedRightShift/SignedRightShiftExample01.js: -------------------------------------------------------------------------------- 1 | let oldValue = 64; // equal to binary 1000000 2 | let newValue = oldValue >> 5; // equal to binary 10 which is decimal 2 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BitwiseOperators/UnsignedRightShift/UnsignedRightShiftExample01.js: -------------------------------------------------------------------------------- 1 | let oldValue = 64; // equal to binary 1000000 2 | let newValue = oldValue >>> 5; // equal to binary 10 which is decimal 2 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BooleanOperators/LogicalAND/LogicalANDExample01.js: -------------------------------------------------------------------------------- 1 | let result = true && false; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BooleanOperators/LogicalAND/LogicalANDExample02.js: -------------------------------------------------------------------------------- 1 | let found = true; 2 | let result = (found && someUndeclaredVariable); // error occurs here 3 | console.log(result); // this line never executes 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BooleanOperators/LogicalAND/LogicalANDExample03.js: -------------------------------------------------------------------------------- 1 | let found = false; 2 | let result = (found && someUndeclaredVariable); // no error 3 | console.log(result); // works 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BooleanOperators/LogicalOR/LogicalORExample01.js: -------------------------------------------------------------------------------- 1 | let result = true || false; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BooleanOperators/LogicalOR/LogicalORExample02.js: -------------------------------------------------------------------------------- 1 | let found = true; 2 | let result = (found || someUndeclaredVariable); // no error 3 | console.log(result); // works 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BooleanOperators/LogicalOR/LogicalORExample03.js: -------------------------------------------------------------------------------- 1 | let found = false; 2 | let result = (found || someUndeclaredVariable); // error occurs here 3 | console.log(result); // this line never executes 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/BooleanOperators/LogicalOR/LogicalORExample04.js: -------------------------------------------------------------------------------- 1 | let myObject = preferredObject || backupObject; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/CommaOperator/CommaOperatorExample01.js: -------------------------------------------------------------------------------- 1 | let num1 = 1, num2 = 2, num3 = 3; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/CommaOperator/CommaOperatorExample02.js: -------------------------------------------------------------------------------- 1 | let num = (5, 1, 4, 8, 0); // num becomes 0 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/ConditionalOperator/ConditionalOperatorExample01.js: -------------------------------------------------------------------------------- 1 | variable = boolean_expression ? true_value : false_value; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/ConditionalOperator/ConditionalOperatorExample02.js: -------------------------------------------------------------------------------- 1 | let max = (num1 > num2) ? num1 : num2; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/MultiplicativeOperators/Divide/DivideExample01.js: -------------------------------------------------------------------------------- 1 | let result = 66 / 11; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/MultiplicativeOperators/Modulus/ModulusExample01.js: -------------------------------------------------------------------------------- 1 | let result = 26 % 5; // equal to 1 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/MultiplicativeOperators/Multiply/MultiplyExample01.js: -------------------------------------------------------------------------------- 1 | let result = 34 * 56; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/RelationalOperators/RelationalOperatorsExample01.js: -------------------------------------------------------------------------------- 1 | let result1 = 5 > 3; // true 2 | let result2 = 5 < 3; // false 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/RelationalOperators/RelationalOperatorsExample02.js: -------------------------------------------------------------------------------- 1 | let result = "Brick" < "alphabet"; // true 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/RelationalOperators/RelationalOperatorsExample03.js: -------------------------------------------------------------------------------- 1 | let result = "Brick".toLowerCase() < "alphabet".toLowerCase(); // false 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/RelationalOperators/RelationalOperatorsExample04.js: -------------------------------------------------------------------------------- 1 | let result = "23" < "3"; // true 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/RelationalOperators/RelationalOperatorsExample05.js: -------------------------------------------------------------------------------- 1 | let result = "23" < 3; // false 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/RelationalOperators/RelationalOperatorsExample06.js: -------------------------------------------------------------------------------- 1 | let result = "a" < 3; // false because "a" becomes NaN 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/RelationalOperators/RelationalOperatorsExample07.js: -------------------------------------------------------------------------------- 1 | let result1 = NaN < 3; // false 2 | let result2 = NaN >= 3; // false 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/UnaryOperators/IncrementDecrement/IncrementDecrementExample01.js: -------------------------------------------------------------------------------- 1 | let age = 29; 2 | ++age; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/UnaryOperators/IncrementDecrement/IncrementDecrementExample02.js: -------------------------------------------------------------------------------- 1 | let age = 29; 2 | age = age + 1; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/UnaryOperators/IncrementDecrement/IncrementDecrementExample03.js: -------------------------------------------------------------------------------- 1 | let age = 29; 2 | --age; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/UnaryOperators/IncrementDecrement/IncrementDecrementExample04.js: -------------------------------------------------------------------------------- 1 | let age = 29; 2 | let anotherAge = --age + 2; 3 | 4 | console.log(age); // 28 5 | console.log(anotherAge); // 30 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/UnaryOperators/IncrementDecrement/IncrementDecrementExample06.js: -------------------------------------------------------------------------------- 1 | let age = 29; 2 | age++; 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/UnaryOperators/UnaryPlusAndMinus/UnaryPlusAndMinusExample01.js: -------------------------------------------------------------------------------- 1 | let num = 25; 2 | num = +num; 3 | console.log(num); // 25 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Operators/UnaryOperators/UnaryPlusAndMinus/UnaryPlusAndMinusExample03.js: -------------------------------------------------------------------------------- 1 | let num = 25; 2 | num = -num; 3 | console.log(num); // -25 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/LabeledStatements/LabeledStatementsExample01.js: -------------------------------------------------------------------------------- 1 | label: statement 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/LabeledStatements/LabeledStatementsExample02.js: -------------------------------------------------------------------------------- 1 | start: for (let i = 0; i < count; i++) { 2 | console.log(i); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheDoWhileStatement/TheDoWhileStatementExample01.js: -------------------------------------------------------------------------------- 1 | do { 2 | statement 3 | } while (expression); 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheDoWhileStatement/TheDoWhileStatementExample02.js: -------------------------------------------------------------------------------- 1 | let i = 0; 2 | do { 3 | i += 2; 4 | } while (i < 10); 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForInStatement/TheForInStatementExample01.js: -------------------------------------------------------------------------------- 1 | for (property in expression) statement 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForInStatement/TheForInStatementExample02.js: -------------------------------------------------------------------------------- 1 | for (const propName in window) { 2 | document.write(propName); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForOfStatement/TheForOfStatementExample01.js: -------------------------------------------------------------------------------- 1 | for (property of expression) statement 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForOfStatement/TheForOfStatementExample02.js: -------------------------------------------------------------------------------- 1 | for (const el in [2,4,6,8) { 2 | document.write(el); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForStatement/TheForStatementExample01.js: -------------------------------------------------------------------------------- 1 | for (initialization; expression; post-loop-expression) statement 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForStatement/TheForStatementExample02.js: -------------------------------------------------------------------------------- 1 | let count = 10; 2 | for (let i = 0; i < count; i++) { 3 | console.log(i); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForStatement/TheForStatementExample03.js: -------------------------------------------------------------------------------- 1 | let count = 10; 2 | let i = 0; 3 | while (i < count) { 4 | console.log(i); 5 | i++; 6 | } 7 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForStatement/TheForStatementExample04.js: -------------------------------------------------------------------------------- 1 | for (;;) { // infinite loop 2 | doSomething(); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheForStatement/TheForStatementExample05.js: -------------------------------------------------------------------------------- 1 | let count = 10; 2 | let i = 0; 3 | for (; i < count; ) { 4 | console.log(i); 5 | i++; 6 | } 7 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheIfStatement/TheIfStatementExample01.js: -------------------------------------------------------------------------------- 1 | if (condition) statement1 else statement2 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheIfStatement/TheIfStatementExample02.js: -------------------------------------------------------------------------------- 1 | if (i > 25) 2 | console.log("Greater than 25."); // one–line statement 3 | else { 4 | console.log("Less than or equal to 25."); // block statement 5 | } 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheIfStatement/TheIfStatementExample03.js: -------------------------------------------------------------------------------- 1 | if (condition1) statement1 else if (condition2) statement2 else statement3 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheWhileStatement/TheWhileStatementExample01.js: -------------------------------------------------------------------------------- 1 | while(expression) statement 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheWhileStatement/TheWhileStatementExample02.js: -------------------------------------------------------------------------------- 1 | let i = 0; 2 | while (i < 10) { 3 | i += 2; 4 | } 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheWithStatement/TheWithStatementExample01.js: -------------------------------------------------------------------------------- 1 | with (expression) statement; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheWithStatement/TheWithStatementExample02.js: -------------------------------------------------------------------------------- 1 | let qs = location.search.substring(1); 2 | let hostName = location.hostname; 3 | let url = location.href; 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Statements/TheWithStatement/TheWithStatementExample03.js: -------------------------------------------------------------------------------- 1 | with(location) { 2 | let qs = search.substring(1); 3 | let hostName = hostname; 4 | let url = href; 5 | } 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Syntax/Comments/CommentsExample01.js: -------------------------------------------------------------------------------- 1 | // single line comment 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Syntax/Identifiers/IdentifiersExample01.js: -------------------------------------------------------------------------------- 1 | firstSecond 2 | myCar 3 | doSomethingImportant 4 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Syntax/Statements/StatementsExample01.js: -------------------------------------------------------------------------------- 1 | let sum = a + b // valid even without a semicolon - not recommended 2 | let diff = a - b; // valid - preferred 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Syntax/Statements/StatementsExample02.js: -------------------------------------------------------------------------------- 1 | if (test) { 2 | test = false; 3 | console.log(test); 4 | } 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Syntax/Statements/StatementsExample03.js: -------------------------------------------------------------------------------- 1 | // valid, but error-prone and should be avoided 2 | if (test) 3 | console.log(test); 4 | 5 | // preferred 6 | if (test) { console.log(test); 7 | } 8 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Syntax/StrictMode/StrictModeExample01.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Syntax/StrictMode/StrictModeExample02.js: -------------------------------------------------------------------------------- 1 | function doSomething() { 2 | "use strict"; 3 | // function body 4 | } 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/ConstDeclarations/ConstDeclarationsExample02.js: -------------------------------------------------------------------------------- 1 | const person = {}; 2 | person.name = 'Matt'; // ok 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/ConstDeclarations/ConstDeclarationsExample03.js: -------------------------------------------------------------------------------- 1 | for (const i = 0; i < 10; ++i) {} // TypeError: assignment to constant variable 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/LetDeclarations/GlobalDeclarations/GlobalDeclarationsExample01.js: -------------------------------------------------------------------------------- 1 | var name = 'Matt'; 2 | console.log(window.name); // 'Matt' 3 | 4 | let age = 26; 5 | console.log(window.age); // undefined 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/LetDeclarations/LetDeclarationInForLoops/LetDeclarationInForLoopsExample01.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < 5; ++i) { 2 | // do loop things 3 | } 4 | console.log(i); // 5 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/LetDeclarations/LetDeclarationInForLoops/LetDeclarationInForLoopsExample02.js: -------------------------------------------------------------------------------- 1 | for (let i = 0; i < 5; ++i) { 2 | // do loop things 3 | } 4 | console.log(i); // ReferenceError: i is not defined 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/LetDeclarations/LetDeclarationInForLoops/LetDeclarationInForLoopsExample04.js: -------------------------------------------------------------------------------- 1 | for (let i = 0; i < 5; ++i) { 2 | setTimeout(() => console.log(i), 0) 3 | } 4 | // console.logs 0, 1, 2, 3, 4 5 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/LetDeclarations/LetDeclarationsExample02.js: -------------------------------------------------------------------------------- 1 | var name; 2 | var name; 3 | 4 | let age; 5 | let age; // SyntaxError; identifier 'age' has already been declared 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/TheVarKeywordExample01.js: -------------------------------------------------------------------------------- 1 | var message; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/TheVarKeywordExample02.js: -------------------------------------------------------------------------------- 1 | var message = "hi"; 2 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/TheVarKeywordExample03.js: -------------------------------------------------------------------------------- 1 | var message = "hi"; 2 | message = 100; // legal, but not recommended 3 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/VarDeclarationHoisting/VarDeclarationHoistingExample01.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.log(age); 3 | var age = 26; 4 | } 5 | foo(); // undefined 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/VarDeclarationHoisting/VarDeclarationHoistingExample02.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var age; 3 | console.log(age); 4 | age = 26; 5 | } 6 | foo(); // undefined 7 | 8 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/VarDeclarationScope/VarDeclarationScopeExample01.js: -------------------------------------------------------------------------------- 1 | function test() { 2 | var message = "hi"; // local variable 3 | } 4 | test(); 5 | console.log(message); // error! 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/VarDeclarationScope/VarDeclarationScopeExample02.js: -------------------------------------------------------------------------------- 1 | function test() { 2 | message = "hi"; // global variable 3 | } 4 | test(); 5 | console.log(message); // "hi" 6 | -------------------------------------------------------------------------------- /Chapter3LanguageBasics/Variables/TheVarKeyword/VarDeclarationScope/VarDeclarationScopeExample03.js: -------------------------------------------------------------------------------- 1 | var message = "hi", 2 | found = false, 3 | age = 29; 4 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/GarbageCollection/ManagingMemory/HiddenClassesAndTheDeleteOperation/HiddenClassesAndTheDeleteOperationExample02.js: -------------------------------------------------------------------------------- 1 | a2.author = 'Jake'; 2 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/GarbageCollection/ManagingMemory/MemoryLeaks/MemoryLeaksExample01.js: -------------------------------------------------------------------------------- 1 | function setName() { 2 | name = 'Jake'; 3 | } 4 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/GarbageCollection/ManagingMemory/MemoryLeaks/MemoryLeaksExample02.js: -------------------------------------------------------------------------------- 1 | let name = 'Jake'; 2 | setInterval(() => { 3 | console.log(name); 4 | }, 100); 5 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/GarbageCollection/ManagingMemory/MemoryLeaks/MemoryLeaksExample03.js: -------------------------------------------------------------------------------- 1 | 2 | let outer = function() { 3 | let name = 'Jake'; 4 | return function() { 5 | return name; 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/GarbageCollection/ManagingMemory/StaticAllocationAndObjectPools/StaticAllocationAndObjectPoolsExample04.js: -------------------------------------------------------------------------------- 1 | let vectorList = new Array(100); 2 | let vector = new Vector(); 3 | vectorList.push(vector); 4 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/GarbageCollection/ReferenceCounting/ReferenceCountingExample03.js: -------------------------------------------------------------------------------- 1 | myObject.element = null; 2 | element.someObject = null; 3 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/PrimitiveAndReferenceValues/CopyingValues/CopyingValuesExample01.js: -------------------------------------------------------------------------------- 1 | let num1 = 5; 2 | let num2 = num1; 3 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/PrimitiveAndReferenceValues/CopyingValues/CopyingValuesExample02.js: -------------------------------------------------------------------------------- 1 | let obj1 = new Object(); 2 | let obj2 = obj1; 3 | obj1.name = "Nicholas"; 4 | console.log(obj2.name); // "Nicholas" 5 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/PrimitiveAndReferenceValues/DeterminingType/DeterminingTypeExample02.js: -------------------------------------------------------------------------------- 1 | result = variable instanceof constructor 2 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/PrimitiveAndReferenceValues/DynamicProperties/DynamicPropertiesExample01.js: -------------------------------------------------------------------------------- 1 | let person = new Object(); 2 | person.name = "Nicholas"; 3 | console.log(person.name); // "Nicholas" 4 | -------------------------------------------------------------------------------- /Chapter4VariablesScopeAndMemory/PrimitiveAndReferenceValues/DynamicProperties/DynamicPropertiesExample02.js: -------------------------------------------------------------------------------- 1 | let name = "Nicholas"; 2 | name.age = 27; 3 | console.log(name.age); // undefined 4 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/Chapter5BasicReferenceTypesExample01.js: -------------------------------------------------------------------------------- 1 | let now = new Date(); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/PrimitiveWrapperTypesExample01.js: -------------------------------------------------------------------------------- 1 | let s1 = "some text"; 2 | let s2 = s1.substring(2); 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/PrimitiveWrapperTypesExample02.js: -------------------------------------------------------------------------------- 1 | let s1 = new String("some text"); 2 | let s2 = s1.substring(2); 3 | s1 = null; 4 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/PrimitiveWrapperTypesExample03.js: -------------------------------------------------------------------------------- 1 | let s1 = "some text"; 2 | s1.color = "red"; 3 | console.log(s1.color); // undefined 4 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/PrimitiveWrapperTypesExample04.js: -------------------------------------------------------------------------------- 1 | let obj = new Object("some text"); 2 | console.log(obj instanceof String); // true 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheBooleanType/TheBooleanTypeExample01.js: -------------------------------------------------------------------------------- 1 | let booleanObject = new Boolean(true); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheNumberType/TheNumberTypeExample01.js: -------------------------------------------------------------------------------- 1 | let numberObject = new Number(10); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheNumberType/TheNumberTypeExample03.js: -------------------------------------------------------------------------------- 1 | let num = 10; 2 | console.log(num.toFixed(2)); // "10.00" 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheNumberType/TheNumberTypeExample04.js: -------------------------------------------------------------------------------- 1 | let num = 10.005; 2 | console.log(num.toFixed(2)); // "10.01" 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheNumberType/TheNumberTypeExample05.js: -------------------------------------------------------------------------------- 1 | let num = 10; 2 | console.log(num.toExponential(1)); // "1.0e+1" 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheStringType/StringPatternMatchingMethods/StringPatternMatchingMethodsExample02.js: -------------------------------------------------------------------------------- 1 | let text = "cat, bat, sat, fat"; 2 | let pos = text.search(/at/); 3 | console.log(pos); // 1 4 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheStringType/TheJavaScriptCharacter/TheJavaScriptCharacterExample01.js: -------------------------------------------------------------------------------- 1 | let message = "abcde"; 2 | 3 | console.log(message.length); // 5 4 | 5 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheStringType/TheJavaScriptCharacter/TheJavaScriptCharacterExample02.js: -------------------------------------------------------------------------------- 1 | let message = "abcde"; 2 | 3 | console.log(message.charAt(2)); // "c" 4 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheStringType/TheJavaScriptCharacter/TheJavaScriptCharacterExample07.js: -------------------------------------------------------------------------------- 1 | console.log([..."ab😊de"]); // ["a", "b", "😊", "d", "e"] 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheStringType/TheStringTypeExample01.js: -------------------------------------------------------------------------------- 1 | let stringObject = new String("hello world"); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/PrimitiveWrapperTypes/TheStringType/TheStringTypeExample02.js: -------------------------------------------------------------------------------- 1 | let stringValue = "hello world"; 2 | console.log(stringValue.length); // "11" 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheGlobalObject/TheEvalMethod/TheEvalMethodExample01.js: -------------------------------------------------------------------------------- 1 | eval("console.log('hi')"); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheGlobalObject/TheEvalMethod/TheEvalMethodExample02.js: -------------------------------------------------------------------------------- 1 | console.log("hi"); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheGlobalObject/TheEvalMethod/TheEvalMethodExample03.js: -------------------------------------------------------------------------------- 1 | let msg = "hello world"; 2 | eval("console.log(msg)"); // "hello world" 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheGlobalObject/TheEvalMethod/TheEvalMethodExample04.js: -------------------------------------------------------------------------------- 1 | eval("function sayHi() { console.log('hi'); }"); 2 | sayHi(); 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheGlobalObject/TheEvalMethod/TheEvalMethodExample05.js: -------------------------------------------------------------------------------- 1 | eval("let msg = 'hello world';"); 2 | console.log(msg); // "hello world" 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheGlobalObject/TheEvalMethod/TheEvalMethodExample06.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | eval = "hi"; // causes error 3 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheGlobalObject/TheWindowObject/TheWindowObjectExample02.js: -------------------------------------------------------------------------------- 1 | let global = function() { 2 | return this; 3 | }(); 4 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheMathObject/TheRandomMethod/TheRandomMethodExample01.js: -------------------------------------------------------------------------------- 1 | number = Math.floor(Math.random() * total_number_of_choices + first_possible_value) 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheMathObject/TheRandomMethod/TheRandomMethodExample02.js: -------------------------------------------------------------------------------- 1 | let num = Math.floor(Math.random() * 10 + 1); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/SingletonBuiltInObjects/TheMathObject/TheRandomMethod/TheRandomMethodExample03.js: -------------------------------------------------------------------------------- 1 | let num = Math.floor(Math.random() * 9 + 2); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/TheDateType/TheDateTypeExample01.js: -------------------------------------------------------------------------------- 1 | let now = new Date(); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/TheDateType/TheDateTypeExample02.js: -------------------------------------------------------------------------------- 1 | let someDate = new Date(Date.parse("May 23, 2017")); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/TheDateType/TheDateTypeExample03.js: -------------------------------------------------------------------------------- 1 | let someDate = new Date("May 23, 2017"); 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/TheRegExpType/TheRegExpTypeExample01.js: -------------------------------------------------------------------------------- 1 | let expression = /pattern/flags; 2 | -------------------------------------------------------------------------------- /Chapter5BasicReferenceTypes/TheRegExpType/TheRegExpTypeExample03.js: -------------------------------------------------------------------------------- 1 | ( [ { \ ^ $ | ) ] } ? * + . 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/IterationAndSpreadOperators/IterationAndSpreadOperatorsExample04.js: -------------------------------------------------------------------------------- 1 | let arr1 = [1, 2, 3]; 2 | let arr2 = [0, ...arr1, 4, 5]; 3 | 4 | console.log(arr2); // [0, 1, 2, 3, 4, 5] 5 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/IterationAndSpreadOperators/IterationAndSpreadOperatorsExample05.js: -------------------------------------------------------------------------------- 1 | let arr1 = [{}]; 2 | let arr2 = [...arr1]; 3 | 4 | arr1[0].foo = 'bar'; 5 | console.log(arr2[0]); // { foo: 'bar' } 6 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ArrayHoles/ArrayHolesExample01.js: -------------------------------------------------------------------------------- 1 | const options = [,,,,,]; // Creates an array with 5 items 2 | alert(options.length); // 5 3 | alert(options); // [,,,,,] 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ConversionMethods/ConversionMethodsExample03.js: -------------------------------------------------------------------------------- 1 | let colors = ["red", "green", "blue"]; 2 | alert(colors.join(",")); // red,green,blue 3 | alert(colors.join("||")); // red||green||blue 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/CreatingArrays/CreatingArraysExample01.js: -------------------------------------------------------------------------------- 1 | let colors = new Array(); 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/CreatingArrays/CreatingArraysExample02.js: -------------------------------------------------------------------------------- 1 | let colors = new Array(20); 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/CreatingArrays/CreatingArraysExample03.js: -------------------------------------------------------------------------------- 1 | let colors = new Array("red", "blue", "green"); 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/CreatingArrays/CreatingArraysExample05.js: -------------------------------------------------------------------------------- 1 | let colors = Array(3); // create an array with three items 2 | let names = Array("Greg"); // create an array with one item, the string "Greg" 3 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/DetectingArrays/DetectingArraysExample01.js: -------------------------------------------------------------------------------- 1 | if (value instanceof Array){ 2 | // do something on the array 3 | } 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/IndexingIntoArrays/IndexingIntoArraysExample03.js: -------------------------------------------------------------------------------- 1 | let colors = ["red", "blue", "green"]; // creates an array with three strings 2 | colors.length = 2; 3 | alert(colors[2]); // undefined 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/IndexingIntoArrays/IndexingIntoArraysExample04.js: -------------------------------------------------------------------------------- 1 | let colors = ["red", "blue", "green"]; // creates an array with three strings 2 | colors.length = 4; 3 | alert(colors[3]); // undefined 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/IterativeMethods/IterativeMethodsExample04.js: -------------------------------------------------------------------------------- 1 | let numbers = [1, 2, 3, 4, 5, 4, 3, 2, 1]; 2 | 3 | numbers.forEach((item, index, array) => { 4 | // do something here 5 | }); 6 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ReductionMethods/ReductionMethodsExample01.js: -------------------------------------------------------------------------------- 1 | let values = [1, 2, 3, 4, 5]; 2 | let sum = values.reduce((prev, cur, index, array) => prev + cur); 3 | 4 | alert(sum); // 15 5 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ReorderingMethods/ReorderingMethodsExample01.js: -------------------------------------------------------------------------------- 1 | let values = [1, 2, 3, 4, 5]; 2 | values.reverse(); 3 | alert(values); // 5,4,3,2,1 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ReorderingMethods/ReorderingMethodsExample02.js: -------------------------------------------------------------------------------- 1 | let values = [0, 1, 5, 10, 15]; 2 | values.sort(); 3 | alert(values); // 0,1,10,15,5 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ReorderingMethods/ReorderingMethodsExample04.js: -------------------------------------------------------------------------------- 1 | let values = [0, 1, 5, 10, 15]; 2 | values.sort(compare); 3 | alert(values); // 0,1,5,10,15 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ReorderingMethods/ReorderingMethodsExample06.js: -------------------------------------------------------------------------------- 1 | let values = [0, 1, 5, 10, 15]; 2 | values.sort((a, b) => a < b ? a > b ? -1 : 0); 3 | alert(values); // 15,10,5,1,0 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheArrayType/ReorderingMethods/ReorderingMethodsExample07.js: -------------------------------------------------------------------------------- 1 | function compare(value1, value2){ 2 | return value2 - value1; 3 | } 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheMapType/BasicAPI/BasicAPIExample03.js: -------------------------------------------------------------------------------- 1 | const m = new Map().set("key1", "val1"); 2 | 3 | m.set("key2", "val2") 4 | .set("key3", "val3"); 5 | 6 | alert(m.size); // 3 7 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheObjectType/TheObjectTypeExample01.js: -------------------------------------------------------------------------------- 1 | let person = new Object(); 2 | person.name = "Nicholas"; 3 | person.age = 29; 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheObjectType/TheObjectTypeExample02.js: -------------------------------------------------------------------------------- 1 | let person = { 2 | name: "Nicholas", 3 | age: 29 4 | }; 5 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheObjectType/TheObjectTypeExample03.js: -------------------------------------------------------------------------------- 1 | let person = { 2 | "name": "Nicholas", 3 | "age": 29, 4 | 5: true 5 | }; 6 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheObjectType/TheObjectTypeExample04.js: -------------------------------------------------------------------------------- 1 | let person = {}; // same as new Object() 2 | person.name = "Nicholas"; 3 | person.age = 29; 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheObjectType/TheObjectTypeExample06.js: -------------------------------------------------------------------------------- 1 | alert(person["name"]); // "Nicholas" 2 | alert(person.name); // "Nicholas" 3 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheObjectType/TheObjectTypeExample07.js: -------------------------------------------------------------------------------- 1 | let propertyName = "name"; 2 | alert(person[propertyName]); // "Nicholas" 3 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheObjectType/TheObjectTypeExample08.js: -------------------------------------------------------------------------------- 1 | person["first name"] = "Nicholas"; 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheSetType/BasicAPI/BasicAPIExample01.js: -------------------------------------------------------------------------------- 1 | const m = new Set(); 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheSetType/BasicAPI/BasicAPIExample04.js: -------------------------------------------------------------------------------- 1 | const s = new Set().add("val1"); 2 | 3 | s.set("val2") 4 | .set("val3"); 5 | 6 | alert(s.size); // 3 7 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheSetType/OrderAndIteration/OrderAndIterationExample02.js: -------------------------------------------------------------------------------- 1 | const s = new Set(["val1", "val2", "val3"]); 2 | 3 | alert([...s]); // [val1,val2,val3] 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheWeakMapType/BasicAPI/BasicAPIExample01.js: -------------------------------------------------------------------------------- 1 | const wm = new WeakMap(); 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheWeakMapType/WeakKeys/WeakKeysExample01.js: -------------------------------------------------------------------------------- 1 | const wm = new WeakMap(); 2 | 3 | wm.set({}, "val"); 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheWeakSetType/BasicAPI/BasicAPIExample01.js: -------------------------------------------------------------------------------- 1 | const ws = new WeakSet(); 2 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TheWeakSetType/WeakKeys/WeakKeysExample01.js: -------------------------------------------------------------------------------- 1 | const ws = new WeakSet(); 2 | 3 | ws.add({}); 4 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TypedArrays/TypedArrays/UnderflowAndOverflow/UnderflowAndOverflowExample02.js: -------------------------------------------------------------------------------- 1 | const clampedInts = new Uint8ClampedArray([-1, 0, 255, 256]); 2 | alert(clampedInts); // [0, 0, 255, 255] 3 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TypedArrays/UsingArrayBuffers/UsingArrayBuffersExample01.js: -------------------------------------------------------------------------------- 1 | const buf = new ArrayBuffer(16); // Allocates 16 bytes of memory 2 | alert(buf.byteLength); // 16 3 | -------------------------------------------------------------------------------- /Chapter6CollectionReferenceTypes/TypedArrays/UsingArrayBuffers/UsingArrayBuffersExample02.js: -------------------------------------------------------------------------------- 1 | const buf1 = new ArrayBuffer(16); 2 | const buf2 = buf1.slice(4, 12); 3 | alert(buf2.byteLength); // 8 4 | -------------------------------------------------------------------------------- /Chapter7IteratorsAndGenerators/IntroductionToIteration/IntroductionToIterationExample01.js: -------------------------------------------------------------------------------- 1 | for (let i = 1; i <= 10; ++i) { 2 | console.log(i); 3 | } 4 | -------------------------------------------------------------------------------- /Chapter8ObjectsClassesAndObjectOrientedProgramming/ObjectCreation/TheFunctionConstructorPattern/ProblemsWithConstructors/ProblemsWithConstructorsExample02.js: -------------------------------------------------------------------------------- 1 | console.log(person1.sayName == person2.sayName); // false 2 | -------------------------------------------------------------------------------- /Chapter8ObjectsClassesAndObjectOrientedProgramming/UnderstandingObjects/TypesOfProperties/DataProperties/DataPropertiesExample01.js: -------------------------------------------------------------------------------- 1 | let person = { 2 | name: "Nicholas" 3 | }; 4 | -------------------------------------------------------------------------------- /Chapter9ProxiesAndReflect/ProxyFundamentals/UtilityOfTheReflectAPI/SafeFunctionApplication/SafeFunctionApplicationExample01.js: -------------------------------------------------------------------------------- 1 | Function.prototype.apply.call(myFunc, thisVal, argumentList); 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Source code for Professional JavaScript for Web Developers 2 | 3 | Available for purchase here: https://www.amazon.com/Professional-JavaScript-Developers-Matt-Frisbie/dp/1119366445/ 4 | --------------------------------------------------------------------------------