{"id":25834504,"url":"https://github.com/codewitheshayoutube/js-interview-qs-","last_synced_at":"2026-01-28T04:03:23.328Z","repository":{"id":260578468,"uuid":"881729051","full_name":"codewithEshaYoutube/JS-Interview-Qs-","owner":"codewithEshaYoutube","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-01T05:34:46.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-26T23:42:21.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codewithEshaYoutube.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-01T05:24:33.000Z","updated_at":"2024-11-05T07:01:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a8f554c-36b2-4112-9699-0c1eb180ec8e","html_url":"https://github.com/codewithEshaYoutube/JS-Interview-Qs-","commit_stats":null,"previous_names":["codewitheshayoutube/js-interview-qs-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codewithEshaYoutube/JS-Interview-Qs-","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithEshaYoutube%2FJS-Interview-Qs-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithEshaYoutube%2FJS-Interview-Qs-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithEshaYoutube%2FJS-Interview-Qs-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithEshaYoutube%2FJS-Interview-Qs-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithEshaYoutube","download_url":"https://codeload.github.com/codewithEshaYoutube/JS-Interview-Qs-/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithEshaYoutube%2FJS-Interview-Qs-/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28837871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T02:10:51.810Z","status":"ssl_error","status_checked_at":"2026-01-28T02:10:50.806Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-01T00:58:29.934Z","updated_at":"2026-01-28T04:03:23.323Z","avatar_url":"https://github.com/codewithEshaYoutube.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌟 Top 30 JavaScript Interview Questions for FAANG Companies 🌟\n\n## 1. What is JavaScript?\n- A high-level, interpreted programming language primarily used for web development.\n\n---\n\n## 2. Explain the difference between `var`, `let`, and `const`.\n- **`var`**: Function-scoped or globally scoped, can be re-declared.\n- **`let`**: Block-scoped, cannot be re-declared in the same block.\n- **`const`**: Block-scoped, must be initialized at declaration, cannot be re-assigned.\n\n---\n\n## 3. What are closures in JavaScript?\n- Functions that retain access to their lexical scope even when the function is executed outside that scope.\n\n---\n\n## 4. What is the event loop in JavaScript?\n- A mechanism that handles asynchronous callbacks, allowing non-blocking I/O operations.\n\n---\n\n## 5. Explain the concept of hoisting.\n- Variable and function declarations are moved to the top of their containing scope during compilation.\n\n---\n\n## 6. What are promises in JavaScript?\n- Objects that represent the eventual completion (or failure) of an asynchronous operation and its resulting value.\n\n---\n\n## 7. How do you handle errors in JavaScript?\n- Using `try...catch` statements, and promise `.catch()` for handling asynchronous errors.\n\n---\n\n## 8. What is the difference between synchronous and asynchronous code?\n- **Synchronous**: Runs sequentially.\n- **Asynchronous**: Allows other operations to run before completing a task.\n\n---\n\n## 9. Describe the `this` keyword in JavaScript.\n- Refers to the object from which a function was called, context-dependent based on how a function is invoked.\n\n---\n\n## 10. What are arrow functions?\n- Shorter syntax for writing functions, automatically binding `this` to the surrounding context.\n\n---\n\n## 11. What is the purpose of `bind()`, `call()`, and `apply()`?\n- Methods to set the `this` context for functions:\n  - **`bind()`**: Returns a new function with bound `this`.\n  - **`call()`**: Invokes a function with a specified `this` value.\n  - **`apply()`**: Similar to `call()`, but accepts an array of arguments.\n\n---\n\n## 12. Explain the concept of the prototype chain.\n- Mechanism by which JavaScript objects inherit properties and methods from other objects through their prototype.\n\n---\n\n## 13. What are higher-order functions?\n- Functions that take other functions as arguments or return them as output.\n\n---\n\n## 14. What is the difference between `==` and `===`?\n- **`==`**: Abstract equality (coerces types).\n- **`===`**: Strict equality (no type coercion).\n\n---\n\n## 15. Describe the `fetch` API.\n- A modern interface for making HTTP requests, returning promises that resolve to the response of the request.\n\n---\n\n## 16. What is the significance of the `async` and `await` keywords?\n- Used to work with promises in a more synchronous manner, making asynchronous code easier to read and write.\n\n---\n\n## 17. Explain destructuring assignment.\n- A syntax that allows unpacking values from arrays or properties from objects into distinct variables.\n\n---\n\n## 18. What is the spread operator?\n- A syntax (`...`) that expands an iterable into more elements, useful for array and object manipulation.\n\n---\n\n## 19. How does garbage collection work in JavaScript?\n- Automatic memory management process that frees up memory by removing objects no longer in use.\n\n---\n\n## 20. What is a JavaScript module?\n- A file or script that exports functions, objects, or variables, allowing code reuse and modularity.\n\n---\n\n## 21. Explain the concept of immutability.\n- The state of an object cannot be modified after it is created, often used with libraries like Immutable.js.\n\n---\n\n## 22. What are template literals?\n- String literals that allow embedded expressions, multi-line strings, and improved readability.\n\n---\n\n## 23. How do you optimize JavaScript performance?\n- Techniques include minimizing DOM manipulation, using debouncing/throttling for events, and optimizing loops.\n\n---\n\n## 24. What are service workers?\n- Scripts that run in the background, separate from web pages, enabling features like caching and background sync.\n\n---\n\n## 25. Explain the difference between `setTimeout` and `setInterval`.\n- **`setTimeout`**: Executes a function once after a delay.\n- **`setInterval`**: Repeatedly executes a function at specified intervals.\n\n---\n\n## 26. How do you retrieve data using a callback function in JavaScript?\n### Example Code:\n```html\n\u003cscript\u003e\n// Simulated API call\nfunction fetchUserData(callback) {\n    setTimeout(() =\u003e {\n        const userData = {\n            name: \"John Doe\",\n            age: 30,\n            email: \"john.doe@example.com\"\n        };\n        // Call the callback function with the retrieved data\n        callback(userData);\n    }, 1000); // Simulates a 1-second delay\n}\n\n// Callback function to process user data\nfunction processUserData(data) {\n    console.log(\"User Data Retrieved:\");\n    console.log(`Name: ${data.name}`);\n    console.log(`Age: ${data.age}`);\n    console.log(`Email: ${data.email}`);\n}\n\n// Retrieve user data and process it\nfetchUserData(processUserData);\n\u003c/script\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewitheshayoutube%2Fjs-interview-qs-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewitheshayoutube%2Fjs-interview-qs-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewitheshayoutube%2Fjs-interview-qs-/lists"}