| W3docs | https://www.w3docs.com/ |
| Learn HTML | https://www.w3docs.com/learn-html |
| Learn CSS | https://www.w3docs.com/learn-css |
| Learn JavaScript | https://www.w3docs.com/learn-javascript |
| Learn Git | https://www.w3docs.com/learn-git |
| Learn Java | https://www.w3docs.com/learn-java |
| Learn PHP | https://www.w3docs.com/learn-php |
| Learn Python | https://www.w3docs.com/learn-python |
| Courses | https://www.w3docs.com/course |
| Quizzes | https://www.w3docs.com/quiz |
| Exercises | https://www.w3docs.com/exercise |
| Snippets | https://www.w3docs.com/snippets |
| HTML Editor | https://www.w3docs.com/tools/editor |
| Password Generator | https://www.w3docs.com/tools/password-generator |
| HTML Encoder | https://www.w3docs.com/tools/html-encoder |
| Code Diff | https://www.w3docs.com/tools/code-diff |
| JSON Beautifier | https://www.w3docs.com/tools/json-beautify |
| All 13 → | https://www.w3docs.com/tool |
| Color Picker | https://www.w3docs.com/color/color-picker |
| Color Converter | https://www.w3docs.com/color/color-converter |
| Color mixer | https://www.w3docs.com/color/color-mixer |
| Color Hex | https://www.w3docs.com/color/color-hex |
| Colors HSL | https://www.w3docs.com/color/color-hsl |
| All 10 → | https://www.w3docs.com/tool |
| String Length Calculator | https://www.w3docs.com/tools/string-length-calculator |
| MD5 Hash Generator | https://www.w3docs.com/tools/string-md5-generator |
| Sha256 Hash Generator | https://www.w3docs.com/tools/string-sha256-generator |
| String Reverse | https://www.w3docs.com/tools/string-revers |
| URL Encoder | https://www.w3docs.com/tools/string-url-encoder |
| All 19 → | https://www.w3docs.com/tool |
| Javascript Formatter | https://www.w3docs.com/tools/formatter/javascript |
| CSS Formatter | https://www.w3docs.com/tools/formatter/css |
| HTML Formatter | https://www.w3docs.com/tools/formatter/html |
| Json Formatter | https://www.w3docs.com/tools/formatter/json |
| PHP Formatter | https://www.w3docs.com/tools/formatter/php |
| Englishen | https://www.w3docs.com/learn-javascript/javascript-animations |
| Deutschde | https://de.w3docs.com/learn-javascript/javascript-animations |
| Русскийru | https://ru.w3docs.com/learn-javascript/javascript-animations |
| Françaisfr | https://fr.w3docs.com/learn-javascript/javascript-animations |
| Españoles | https://es.w3docs.com/learn-javascript/javascript-animations |
| Portuguêspt | https://pt.w3docs.com/learn-javascript/javascript-animations |
| Italianoit | https://it.w3docs.com/learn-javascript/javascript-animations |
| Log in | https://www.w3docs.com/api/auth/login |
| Learn JavaScript | https://www.w3docs.com/learn-javascript |
| Introduction | https://www.w3docs.com/learn-javascript/javascript-intro |
| Start using Javascript | https://www.w3docs.com/learn-javascript/start-using-javascript |
| JS Comments | https://www.w3docs.com/learn-javascript/javascript-comments |
| JS with DOM | https://www.w3docs.com/learn-javascript/javascript-with-dom |
| JS Use Strict | https://www.w3docs.com/learn-javascript/javascript-use-strict |
| JS Variables | https://www.w3docs.com/learn-javascript/javascript-variables |
| JS Data Types | https://www.w3docs.com/learn-javascript/javascript-data-types |
| JS Type Conversions | https://www.w3docs.com/learn-javascript/type-conversions |
| JS Interactive Functions | https://www.w3docs.com/learn-javascript/interactive-functions |
| JS Operators | https://www.w3docs.com/learn-javascript/operators |
| JS Comparison operators | https://www.w3docs.com/learn-javascript/comparison-operators |
| JS Logical Operators | https://www.w3docs.com/learn-javascript/logical-operators |
| JS Nullish Coalescing (??) | https://www.w3docs.com/learn-javascript/nullish-coalescing-operator |
| JS Conditional operators | https://www.w3docs.com/learn-javascript/conditional-operators |
| JS Switch | https://www.w3docs.com/learn-javascript/javascript-switch |
| JS Loops | https://www.w3docs.com/learn-javascript/javascript-loops |
| JS Functions | https://www.w3docs.com/learn-javascript/javascript-functions |
| JS Function Expressions | https://www.w3docs.com/learn-javascript/function-expressions |
| JS Arrow Functions | https://www.w3docs.com/learn-javascript/arrow-functions-the-basics |
| JS ES6 | https://www.w3docs.com/learn-javascript/javascript-es6 |
| JS Objects | https://www.w3docs.com/learn-javascript/javascript-objects |
| JS Object Copying | https://www.w3docs.com/learn-javascript/object-references-and-copying |
| JS Object methods, "this" | https://www.w3docs.com/learn-javascript/object-methods-this |
| JS Garbage collection | https://www.w3docs.com/learn-javascript/garbage-collection |
| JS Symbol Types | https://www.w3docs.com/learn-javascript/symbol-types |
| JS Object to Primitive Conversion | https://www.w3docs.com/learn-javascript/object-to-primitive-conversion |
| JS Constructor, operator "new" | https://www.w3docs.com/learn-javascript/constructor-operator-new |
| JS Optional Chaining (?.) | https://www.w3docs.com/learn-javascript/optional-chaining |
| JS Methods of primitives | https://www.w3docs.com/learn-javascript/methods-of-primitives |
| JS Numbers | https://www.w3docs.com/learn-javascript/numbers |
| JS Math | https://www.w3docs.com/learn-javascript/javascript-math |
| JS Strings | https://www.w3docs.com/learn-javascript/strings |
| JS Arrays | https://www.w3docs.com/learn-javascript/javascript-array |
| JS Array methods | https://www.w3docs.com/learn-javascript/array-methods |
| JS Iterables | https://www.w3docs.com/learn-javascript/iterables |
| JS Map and Set | https://www.w3docs.com/learn-javascript/map-and-set |
| JS WeakMap and WeakSet | https://www.w3docs.com/learn-javascript/weakmap-and-weakset |
| JS Object.keys, Values, Entries | https://www.w3docs.com/learn-javascript/object-keys-values-entries |
| JS Destructuring Assignment | https://www.w3docs.com/learn-javascript/destructuring-assignment |
| JS Date and time | https://www.w3docs.com/learn-javascript/javascript-date |
| JS JSON methods, toJSON | https://www.w3docs.com/learn-javascript/working-with-json |
| JS Recursion and Stack | https://www.w3docs.com/learn-javascript/recursion-and-stack |
| JS Rest Parameters and Spread Syntax | https://www.w3docs.com/learn-javascript/rest-parameters-and-spread-syntax |
| JS Variable scope | https://www.w3docs.com/learn-javascript/variable-scope |
| JS The Old “var” | https://www.w3docs.com/learn-javascript/the-old-var |
| JS Global Object | https://www.w3docs.com/learn-javascript/global-object |
| JS Function object, NFE | https://www.w3docs.com/learn-javascript/function-object-nfe |
| JS The “new function” Syntax | https://www.w3docs.com/learn-javascript/the-new-function-syntax |
| JS setTimeout and setInterval | https://www.w3docs.com/learn-javascript/scheduling-settimeout-and-setinterval |
| JS Decorators and forwarding, call/apply | https://www.w3docs.com/learn-javascript/decorators-and-forwarding-call-apply |
| JS Debounce & Throttle | https://www.w3docs.com/learn-javascript/debounce-and-throttle |
| JS Function Binding | https://www.w3docs.com/learn-javascript/function-binding |
| JS Arrow functions revisited | https://www.w3docs.com/learn-javascript/arrow-functions-revisited |
| JS Closures | https://www.w3docs.com/learn-javascript/javascript-closures |
| JS Property Flags and Descriptors | https://www.w3docs.com/learn-javascript/property-flags-and-descriptors |
| JS Property Getters and Setters | https://www.w3docs.com/learn-javascript/property-getters-and-setters |
| DOM Introduction | https://www.w3docs.com/learn-javascript/javascript-html-dom |
| The DOM Nodes | https://www.w3docs.com/learn-javascript/understanding-the-dom-nodes |
| Selecting DOM Elements | https://www.w3docs.com/learn-javascript/selecting-dom-elements |
| Manipulating the DOM | https://www.w3docs.com/learn-javascript/dom-manipulation |
| Working with Styles in DOM | https://www.w3docs.com/learn-javascript/working-with-styles-in-dom |
| Event Handling in DOM | https://www.w3docs.com/learn-javascript/event-handling-in-dom |
| Traversing the DOM | https://www.w3docs.com/learn-javascript/traversing-the-dom |
| DOM Manipulation Techniques | https://www.w3docs.com/learn-javascript/dom-manipulation-techniques |
| Working with Forms in DOM | https://www.w3docs.com/learn-javascript/working-with-forms-in-dom |
| Advanced DOM Techniques | https://www.w3docs.com/learn-javascript/advanced-dom-techniques |
| DOM Manipulation Libraries | https://www.w3docs.com/learn-javascript/dom-manipulation-libraries |
| DOM Browser Compatibility | https://www.w3docs.com/learn-javascript/dom-browser-compatibility |
| DOM Accessibility Considerations | https://www.w3docs.com/learn-javascript/dom-accessibility-considerations |
| Debugging and Tools | https://www.w3docs.com/learn-javascript/dom-debugging-and-tools |
| Performance Optimization | https://www.w3docs.com/learn-javascript/dom-performance-optimization |
| Interactive Elements and Widgets | https://www.w3docs.com/learn-javascript/dom-nteractive-elements-and-widgets |
| JS Prototypal inheritance | https://www.w3docs.com/learn-javascript/prototypal-inheritance |
| JS Native Prototypes | https://www.w3docs.com/learn-javascript/native-prototypes |
| JS Prototype Methods, Objects Without `__proto__` | https://www.w3docs.com/learn-javascript/prototype-methods-objects-without-proto |
| JS Class Basic Syntax | https://www.w3docs.com/learn-javascript/class-basic-syntax |
| JS Class inheritance | https://www.w3docs.com/learn-javascript/class-inheritance |
| JS Static properties and methods | https://www.w3docs.com/learn-javascript/static-properties-and-methods |
| JS Private and Protected Properties | https://www.w3docs.com/learn-javascript/private-and-protected-properties-and-methods |
| JS Extending Built-in Classes | https://www.w3docs.com/learn-javascript/extending-built-in-classes |
| JS Class Checking: “instanceof” | https://www.w3docs.com/learn-javascript/class-checking-instanceof |
| JS Mixins | https://www.w3docs.com/learn-javascript/mixins |
| JS Error handling, "try..catch" | https://www.w3docs.com/learn-javascript/error-handling-try-catch |
| JS Custom Errors, Extending Error | https://www.w3docs.com/learn-javascript/custom-errors-extending-error |
| JS Introduction:callbacks | https://www.w3docs.com/learn-javascript/introduction-callbacks |
| JS Promise | https://www.w3docs.com/learn-javascript/promise |
| JS Promise Chaining | https://www.w3docs.com/learn-javascript/promises-chaining |
| JS Error handling with promises | https://www.w3docs.com/learn-javascript/error-handling-with-promises |
| Promise API | https://www.w3docs.com/learn-javascript/promise-api |
| Promisification | https://www.w3docs.com/learn-javascript/promisification |
| Microtasks | https://www.w3docs.com/learn-javascript/microtasks |
| async/await | https://www.w3docs.com/learn-javascript/async-await |
| Generators | https://www.w3docs.com/learn-javascript/generators |
| Async Iterators and Generators | https://www.w3docs.com/learn-javascript/async-iterators-and-generators |
| Modules | https://www.w3docs.com/learn-javascript/modules-introduction |
| Export and Import | https://www.w3docs.com/learn-javascript/export-and-import |
| Dynamic Imports | https://www.w3docs.com/learn-javascript/dynamic-imports |
| Proxy and Reflect | https://www.w3docs.com/learn-javascript/proxy-and-reflect |
| Eval | https://www.w3docs.com/learn-javascript/eval-run-a-code-string |
| Currying | https://www.w3docs.com/learn-javascript/currying |
| BigInt | https://www.w3docs.com/learn-javascript/bigint |
| JS Polyfills & Transpilers | https://www.w3docs.com/learn-javascript/polyfills-and-transpilers |
| Popups and Window Methods | https://www.w3docs.com/learn-javascript/popups-and-window-methods |
| Cross-window Communication | https://www.w3docs.com/learn-javascript/cross-window-communication |
| ArrayBuffer, Binary Arrays | https://www.w3docs.com/learn-javascript/arraybuffer-binary-arrays |
| TextDecoder and TextEncoder | https://www.w3docs.com/learn-javascript/textdecoder-and-textencoder |
| Blob | https://www.w3docs.com/learn-javascript/javascript-blob |
| File and FileReader | https://www.w3docs.com/learn-javascript/file-and-filereader |
| JS Streams API | https://www.w3docs.com/learn-javascript/streams-api |
| Browser Environment, Specs | https://www.w3docs.com/learn-javascript/browser-environment-specs |
| Searching: getElement*, querySelector* | https://www.w3docs.com/learn-javascript/searching-getelement-queryselector |
| Node Properties: Type, Tag and Contents | https://www.w3docs.com/learn-javascript/node-properties-type-tag-and-contents |
| Attributes and Properties | https://www.w3docs.com/learn-javascript/attributes-and-properties |
| Modifying the document | https://www.w3docs.com/learn-javascript/modifying-the-document |
| Styles and Classes | https://www.w3docs.com/learn-javascript/styles-and-classes |
| Window Sizes and Scrolling | https://www.w3docs.com/learn-javascript/javascript-window-sizes-and-scrolling |
| Coordinates | https://www.w3docs.com/learn-javascript/javascript-coordinates |
| JavaScript Introduction to Browser Events | https://www.w3docs.com/learn-javascript/introduction-to-browser-events |
| Bubbling and Capturing | https://www.w3docs.com/learn-javascript/bubbling-and-capturing |
| Event Delegation | https://www.w3docs.com/learn-javascript/javascript-events |
| Browser Default Actions | https://www.w3docs.com/learn-javascript/browser-default-actions |
| Dispatching Custom Events | https://www.w3docs.com/learn-javascript/dispatching-custom-events |
| Mouse Events Basics | https://www.w3docs.com/learn-javascript/mouse-events-basics |
| Moving the mouse | https://www.w3docs.com/learn-javascript/moving-the-mouse-mouseover-out-mouseenter-leave |
| Drag and Drop | https://www.w3docs.com/learn-javascript/drag-and-drop-with-javascript |
| Keyboard: keydown and keyup | https://www.w3docs.com/learn-javascript/keyboard-keydown-and-keyup |
| Scrolling | https://www.w3docs.com/learn-javascript/javascript-scrolling |
| Form Properties and Methods | https://www.w3docs.com/learn-javascript/form-properties-and-methods |
| Focusing: focus/blur | https://www.w3docs.com/learn-javascript/focusing-focus-blur |
| Events: change, input, cut, copy, paste | https://www.w3docs.com/learn-javascript/events-change-input-cut-copy-paste |
| JS Clipboard API | https://www.w3docs.com/learn-javascript/clipboard-api |
| Forms: event and method submit | https://www.w3docs.com/learn-javascript/forms-event-and-method-submit |
| Page:DOMContentLoaded, load, beforeunload, unload | https://www.w3docs.com/learn-javascript/page-domcontentloaded-load-beforeunload-unload |
| Scripts: async, defer | https://www.w3docs.com/learn-javascript/scripts-async-defer |
| Resource Loading: onload and onerror | https://www.w3docs.com/learn-javascript/resource-loading-onload-and-onerror |
| Mutation Observer | https://www.w3docs.com/learn-javascript/mutation-observer |
| JS IntersectionObserver | https://www.w3docs.com/learn-javascript/intersection-observer |
| JS ResizeObserver | https://www.w3docs.com/learn-javascript/resize-observer |
| Selection and Range | https://www.w3docs.com/learn-javascript/selection-and-range |
| Event Loop: microtasks and macrotasks | https://www.w3docs.com/learn-javascript/event-loop-microtasks-and-macrotasks |
| Canvas | https://www.w3docs.com/learn-javascript/canvas |
| Fetch API | https://www.w3docs.com/learn-javascript/fetch-api |
| FormData | https://www.w3docs.com/learn-javascript/javascript-formdata |
| Fetch: download progress | https://www.w3docs.com/learn-javascript/fetch-download-progress |
| Fetch: abort | https://www.w3docs.com/learn-javascript/fetch-abort |
| Fetch: cross-origin requests | https://www.w3docs.com/learn-javascript/javascript-fetch-cross-origin-requests |
| URL Objects | https://www.w3docs.com/learn-javascript/url-objects |
| XMLHttpRequest | https://www.w3docs.com/learn-javascript/xmlhttprequest |
| JS Server-Sent Events | https://www.w3docs.com/learn-javascript/server-sent-events |
| Resumable File Upload | https://www.w3docs.com/learn-javascript/resumable-file-upload |
| Cookies: document.cookie | https://www.w3docs.com/learn-javascript/cookies-document-cookie |
| LocalStorage, SessionStorage | https://www.w3docs.com/learn-javascript/localstorage-sessionstorage |
| IndexedDB | https://www.w3docs.com/learn-javascript/javascript-indexeddb |
| CSS animations | https://www.w3docs.com/learn-javascript/css-animations |
| JavaScript Animations | https://www.w3docs.com/learn-javascript/javascript-animations |
| Web Components | https://www.w3docs.com/learn-javascript/web-components |
| Custom Elements | https://www.w3docs.com/learn-javascript/custom-elements |
| Shadow DOM | https://www.w3docs.com/learn-javascript/javascript-shadow-dom |
| Template Element | https://www.w3docs.com/learn-javascript/template-element |
| Shadow DOM Slots, Composition | https://www.w3docs.com/learn-javascript/shadow-dom-slots-composition |
| Shadow DOM Styling | https://www.w3docs.com/learn-javascript/shadow-dom-styling |
| Shadow DOM and Events | https://www.w3docs.com/learn-javascript/shadow-dom-and-events |
| JS Regex | https://www.w3docs.com/learn-javascript/regex |
| Patterns and Flags | https://www.w3docs.com/learn-javascript/patterns-and-flags |
| Character Classes | https://www.w3docs.com/learn-javascript/character-classes |
| Unicode: flag "u" and class \p{...} | https://www.w3docs.com/learn-javascript/unicode-flag-u-and-class-p |
| Anchors: string start ^ and end $ | https://www.w3docs.com/learn-javascript/anchors-string-start-and-end |
| Multiline Mode of Anchors ^ $, Flag "m" | https://www.w3docs.com/learn-javascript/multiline-mode-of-anchors-flag-m |
| Word Boundary: \b | https://www.w3docs.com/learn-javascript/word-boundary-b |
| Escaping, Special Characters | https://www.w3docs.com/learn-javascript/escaping-special-characters |
| Sets and ranges [...] | https://www.w3docs.com/learn-javascript/javascript-sets-and-ranges |
| Quantifiers +, *, ? and {n} | https://www.w3docs.com/learn-javascript/quantifiers-and-n |
| Greedy and Lazy Quantifiers | https://www.w3docs.com/learn-javascript/greedy-and-lazy-quantifiers |
| Capturing Groups | https://www.w3docs.com/learn-javascript/capturing-groups |
| Backreferences in pattern: \n and \k | https://www.w3docs.com/learn-javascript/backreferences-in-pattern-n-and-k-name |
| JavaScript Alternation (OR) | https://www.w3docs.com/learn-javascript/javascript-alternation-or |
| Lookahead and Lookbehind | https://www.w3docs.com/learn-javascript/lookahead-and-lookbehind |
| Catastrophic Backtracking | https://www.w3docs.com/learn-javascript/catastrophic-backtracking |
| Sticky flag "y", searching at position | https://www.w3docs.com/learn-javascript/sticky-flag-y-searching-at-position |
| Methods of RegExp and String | https://www.w3docs.com/learn-javascript/javascript-regexp |
| Web Animations API | https://www.w3docs.com/learn-javascript/animations-api |
| File API | https://www.w3docs.com/learn-javascript/file-api |
| Battery API | https://www.w3docs.com/learn-javascript/battery-api |
| WebGL | https://www.w3docs.com/learn-javascript/webgl |
| Push API | https://www.w3docs.com/learn-javascript/push-api |
| Screen Orientation API | https://www.w3docs.com/learn-javascript/screen-orientation-api |
| History API | https://www.w3docs.com/learn-javascript/history-api |
| Console API | https://www.w3docs.com/learn-javascript/console-api |
| Fullscreen API | https://www.w3docs.com/learn-javascript/fullscreen-api |
| Validation API | https://www.w3docs.com/learn-javascript/validation-api |
| Web Storage API | https://www.w3docs.com/learn-javascript/storage-api |
| Web MIDI API | https://www.w3docs.com/learn-javascript/web-midi-api |
| JS Web Workers | https://www.w3docs.com/learn-javascript/web-workers |
| Service Workers | https://www.w3docs.com/learn-javascript/service-workers |
| WebSockets | https://www.w3docs.com/learn-javascript/websockets |
| Geolocation | https://www.w3docs.com/learn-javascript/geolocation |
| WebRTC | https://www.w3docs.com/learn-javascript/webrtc |
| Web Audio API | https://www.w3docs.com/learn-javascript/web-audio-api |
| Notifications API | https://www.w3docs.com/learn-javascript/notifications-api |
| The Vibration API | https://www.w3docs.com/learn-javascript/the-vibration-api |
| JS Intl API | https://www.w3docs.com/learn-javascript/intl-api |
| CSS animations | https://www.w3docs.com/learn-javascript/css-animations |
| setInterval and setTimeout | https://www.w3docs.com/learn-javascript/scheduling-settimeout-and-setinterval |
| Try it Yourself » | https://www.w3docs.com/tools/editor#code=PCFET0NUWVBFIGh0bWw-CjxodG1sPgo8aGVhZD4KICA8c3R5bGU-CiAgICAjc3F1YXJlIHsKICAgICAgd2lkdGg6IDUwcHg7CiAgICAgIGhlaWdodDogNTBweDsKICAgICAgYmFja2dyb3VuZC1jb2xvcjogcmVkOwogICAgICBwb3NpdGlvbjogYWJzb2x1dGU7CiAgICAgIGxlZnQ6IDA7CiAgICAgIHRvcDogNTBweDsKICAgIH0KICA8L3N0eWxlPgo8L2hlYWQ-Cjxib2R5PgogIDxkaXYgaWQ9InNxdWFyZSI-PC9kaXY-CiAgPHNjcmlwdD4KICAgIGNvbnN0IHNxdWFyZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzcXVhcmUnKTsKICAgIGxldCBwb3MgPSAwOwoKICAgIGZ1bmN0aW9uIG1vdmUoKSB7CiAgICAgIGlmIChwb3MgPCB3aW5kb3cuaW5uZXJXaWR0aCAtIDUwKSB7CiAgICAgICAgcG9zICs9IDI7CiAgICAgICAgc3F1YXJlLnN0eWxlLnRyYW5zZm9ybSA9ICd0cmFuc2xhdGVYKCcgKyBwb3MgKyAncHgpJzsKICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUobW92ZSk7CiAgICAgIH0KICAgIH0KCiAgICBtb3ZlKCk7CiAgPC9zY3JpcHQ-CjwvYm9keT4KPC9odG1sPg&lang=html |
| Try it Yourself » | https://www.w3docs.com/tools/editor#code=PCFET0NUWVBFIGh0bWw-CjxodG1sPgo8aGVhZD4KICA8c3R5bGU-CiAgICAjc3F1YXJlIHsKICAgICAgd2lkdGg6IDUwcHg7CiAgICAgIGhlaWdodDogNTBweDsKICAgICAgYmFja2dyb3VuZC1jb2xvcjogYmx1ZTsKICAgICAgcG9zaXRpb246IGFic29sdXRlOwogICAgICBsZWZ0OiAwOwogICAgICB0b3A6IDUwcHg7CiAgICB9CiAgPC9zdHlsZT4KPC9oZWFkPgo8Ym9keT4KICA8ZGl2IGlkPSJzcXVhcmUiPjwvZGl2PgogIDxzY3JpcHQ-CiAgICBjb25zdCBzcXVhcmUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnc3F1YXJlJyk7CiAgICBsZXQgc3RhcnQgPSBudWxsOwogICAgY29uc3QgZHVyYXRpb24gPSAyMDAwOyAvLyBBbmltYXRpb24gZHVyYXRpb24gaW4gbWlsbGlzZWNvbmRzCgogICAgZnVuY3Rpb24gZWFzZU91dFF1YWQodCkgewogICAgICByZXR1cm4gdCAqICgyIC0gdCk7CiAgICB9CgogICAgZnVuY3Rpb24gYW5pbWF0ZSh0aW1lc3RhbXApIHsKICAgICAgaWYgKCFzdGFydCkgc3RhcnQgPSB0aW1lc3RhbXA7CiAgICAgIGxldCBlbGFwc2VkID0gdGltZXN0YW1wIC0gc3RhcnQ7CiAgICAgIGxldCBwcm9ncmVzcyA9IE1hdGgubWluKGVsYXBzZWQgLyBkdXJhdGlvbiwgMSk7CiAgICAgIGxldCBlYXNlZFByb2dyZXNzID0gZWFzZU91dFF1YWQocHJvZ3Jlc3MpOwoKICAgICAgc3F1YXJlLnN0eWxlLnRyYW5zZm9ybSA9ICd0cmFuc2xhdGVYKCcgKyAod2luZG93LmlubmVyV2lkdGggLSA1MCkgKiBlYXNlZFByb2dyZXNzICsgJ3B4KSc7CgogICAgICBpZiAocHJvZ3Jlc3MgPCAxKSB7CiAgICAgICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKGFuaW1hdGUpOwogICAgICB9CiAgICB9CgogICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKGFuaW1hdGUpOwogIDwvc2NyaXB0Pgo8L2JvZHk-CjwvaHRtbD4&lang=html |
| Try it Yourself » | https://www.w3docs.com/tools/editor#code=PCFET0NUWVBFIGh0bWw-CjxodG1sPgo8aGVhZD4KICA8c3R5bGU-CiAgICAjc3F1YXJlIHsKICAgICAgd2lkdGg6IDUwcHg7CiAgICAgIGhlaWdodDogNTBweDsKICAgICAgYmFja2dyb3VuZC1jb2xvcjogZ3JlZW47CiAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTsKICAgICAgbGVmdDogMDsKICAgICAgdG9wOiAwOwogICAgfQogIDwvc3R5bGU-CjwvaGVhZD4KPGJvZHk-CiAgPGRpdiBpZD0ic3F1YXJlIj48L2Rpdj4KICA8c2NyaXB0PgogICAgY29uc3Qgc3F1YXJlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3NxdWFyZScpOwogICAgbGV0IHhQb3MgPSAwOwogICAgbGV0IHlQb3MgPSAwOwoKICAgIGZ1bmN0aW9uIG1vdmVSaWdodCgpIHsKICAgICAgaWYgKHhQb3MgPCB3aW5kb3cuaW5uZXJXaWR0aCAtIDUwKSB7CiAgICAgICAgeFBvcyArPSAyOwogICAgICAgIHNxdWFyZS5zdHlsZS50cmFuc2Zvcm0gPSAndHJhbnNsYXRlWCgnICsgeFBvcyArICdweCknOwogICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZShtb3ZlUmlnaHQpOwogICAgICB9IGVsc2UgewogICAgICAgIHhQb3MgPSAwOwogICAgICAgIHlQb3MgPSAwOyAvLyBFeHBsaWNpdGx5IHJlc2V0IHlQb3MgYmVmb3JlIGRvd253YXJkIHBoYXNlCiAgICAgICAgc3F1YXJlLnN0eWxlLnRyYW5zZm9ybSA9ICd0cmFuc2xhdGVYKDBweCknOwogICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZShtb3ZlRG93bik7CiAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBtb3ZlRG93bigpIHsKICAgICAgaWYgKHlQb3MgPCB3aW5kb3cuaW5uZXJIZWlnaHQgLSA1MCkgewogICAgICAgIHlQb3MgKz0gMjsKICAgICAgICBzcXVhcmUuc3R5bGUudHJhbnNmb3JtID0gJ3RyYW5zbGF0ZVkoJyArIHlQb3MgKyAncHgpJzsKICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUobW92ZURvd24pOwogICAgICB9IGVsc2UgewogICAgICAgIHlQb3MgPSAwOyAvLyBSZXNldCBmb3IgcmVwZWF0ZWQgY3ljbGVzCiAgICAgICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKG1vdmVSaWdodCk7CiAgICAgIH0KICAgIH0KCiAgICBtb3ZlUmlnaHQoKTsKICA8L3NjcmlwdD4KPC9ib2R5Pgo8L2h0bWw-&lang=html |
| Try it Yourself » | https://www.w3docs.com/tools/editor#code=PCFET0NUWVBFIGh0bWw-CjxodG1sPgo8aGVhZD4KICA8c3R5bGU-CiAgICAjc3F1YXJlIHsKICAgICAgd2lkdGg6IDUwcHg7CiAgICAgIGhlaWdodDogNTBweDsKICAgICAgYmFja2dyb3VuZC1jb2xvcjogcHVycGxlOwogICAgICBwb3NpdGlvbjogYWJzb2x1dGU7CiAgICAgIGxlZnQ6IDA7CiAgICAgIHRvcDogMDsKICAgIH0KICA8L3N0eWxlPgo8L2hlYWQ-Cjxib2R5PgogIDxkaXYgaWQ9InNxdWFyZSI-PC9kaXY-CiAgPHNjcmlwdD4KICAgIGNvbnN0IHNxdWFyZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzcXVhcmUnKTsKICAgIGxldCBwb3MgPSAwOwoKICAgIGZ1bmN0aW9uIGNoYW5nZUNvbG9yKHByb2dyZXNzKSB7CiAgICAgIGxldCByZWQgPSBNYXRoLmZsb29yKDI1NSAqIHByb2dyZXNzKTsKICAgICAgbGV0IGdyZWVuID0gTWF0aC5mbG9vcigyNTUgKiAoMSAtIHByb2dyZXNzKSk7CiAgICAgIHJldHVybiBgcmdiKCR7cmVkfSwgJHtncmVlbn0sIDApYDsKICAgIH0KCiAgICBmdW5jdGlvbiBhbmltYXRlKCkgewogICAgICBpZiAocG9zIDwgd2luZG93LmlubmVyV2lkdGggLSA1MCkgewogICAgICAgIHBvcyArPSAyOwogICAgICAgIGxldCBwcm9ncmVzcyA9IHBvcyAvICh3aW5kb3cuaW5uZXJXaWR0aCAtIDUwKTsKICAgICAgICBzcXVhcmUuc3R5bGUudHJhbnNmb3JtID0gJ3RyYW5zbGF0ZVgoJyArIHBvcyArICdweCknOwogICAgICAgIHNxdWFyZS5zdHlsZS5iYWNrZ3JvdW5kQ29sb3IgPSBjaGFuZ2VDb2xvcihwcm9ncmVzcyk7CiAgICAgICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKGFuaW1hdGUpOwogICAgICB9CiAgICB9CgogICAgYW5pbWF0ZSgpOwogIDwvc2NyaXB0Pgo8L2JvZHk-CjwvaHRtbD4&lang=html |
| Animation | https://developer.mozilla.org/en-US/docs/Web/API/Animation |
| CSS animations | https://www.w3docs.com/learn-javascript/css-animations |
| CSS animations | https://www.w3docs.com/learn-javascript/css-animations |
| Scheduling: setTimeout and setInterval | https://www.w3docs.com/learn-javascript/scheduling-settimeout-and-setinterval |
| Introduction to browser events | https://www.w3docs.com/learn-javascript/introduction-to-browser-events |
| JavaScript HTML DOM | https://www.w3docs.com/learn-javascript/javascript-html-dom |
| ← PreviousCSS animations | https://www.w3docs.com/learn-javascript/css-animations |
| Next →Web Components | https://www.w3docs.com/learn-javascript/web-components |
| Introduction to JavaScript Animations | https://www.w3docs.com/learn-javascript/javascript-animations#introduction-to-javascript-animations |
| Basic Concepts of JavaScript Animations | https://www.w3docs.com/learn-javascript/javascript-animations#basic-concepts-of-javascript-animations |
| Simple JavaScript Animation Example | https://www.w3docs.com/learn-javascript/javascript-animations#simple-javascript-animation-example |
| Advanced Techniques in JavaScript Animations | https://www.w3docs.com/learn-javascript/javascript-animations#advanced-techniques-in-javascript-animations |
| The Web Animations API | https://www.w3docs.com/learn-javascript/javascript-animations#the-web-animations-api |
| Stopping and Reversing Animations | https://www.w3docs.com/learn-javascript/javascript-animations#stopping-and-reversing-animations |
| Accessibility: Respect Reduced Motion | https://www.w3docs.com/learn-javascript/javascript-animations#accessibility-respect-reduced-motion |
| Performance Optimization for JavaScript Animations | https://www.w3docs.com/learn-javascript/javascript-animations#performance-optimization-for-javascript-animations |
| Conclusion | https://www.w3docs.com/learn-javascript/javascript-animations#conclusion |
| Practice | https://www.w3docs.com/learn-javascript/javascript-animations#practice |
| https://x.com/w3docs |
| https://github.com/w3docs |
| https://linkedin.com/company/w3docs |
| Learn HTML | https://www.w3docs.com/learn-html |
| Learn CSS | https://www.w3docs.com/learn-css |
| Learn JavaScript | https://www.w3docs.com/learn-javascript |
| Learn Git | https://www.w3docs.com/learn-git |
| Learn Java | https://www.w3docs.com/learn-java |
| Learn PHP | https://www.w3docs.com/learn-php |
| Learn Python | https://www.w3docs.com/learn-python |
| Exercises | https://www.w3docs.com/exercise |
| Quizzes | https://www.w3docs.com/quiz |
| Snippets | https://www.w3docs.com/snippets |
| Snippet tags | https://www.w3docs.com/snippets-tags |
| Try-it editor | https://www.w3docs.com/tools/editor |
| HTML Editor | https://www.w3docs.com/tools/editor |
| Password Generator | https://www.w3docs.com/tools/password-generator |
| HTML Encoder | https://www.w3docs.com/tools/html-encoder |
| Code Diff | https://www.w3docs.com/tools/code-diff |
| JSON Beautifier | https://www.w3docs.com/tools/json-beautify |
| About | https://www.w3docs.com/about |
| Contact | https://www.w3docs.com/contact |
| Privacy Policy | https://www.w3docs.com/privacy |
| English | https://www.w3docs.com/learn-javascript/javascript-animations |
| Deutsch | https://de.w3docs.com/learn-javascript/javascript-animations |
| Русский | https://ru.w3docs.com/learn-javascript/javascript-animations |
| Français | https://fr.w3docs.com/learn-javascript/javascript-animations |
| Español | https://es.w3docs.com/learn-javascript/javascript-animations |
| Português | https://pt.w3docs.com/learn-javascript/javascript-animations |
| Italiano | https://it.w3docs.com/learn-javascript/javascript-animations |