├── .github └── FUNDING.yml ├── LICENSE ├── README.md ├── _config.yml └── examples ├── currying.js ├── debounce.js └── flattenArray.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [vinitshahdeo] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Vinit Shahdeo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript Resources 2 | 3 | 4 | 5 | **Here's a curated list of 10 resources to ace your next JavaScript interview.** For learning, [javascript.info](https://javascript.info/) is highly recommended. **If you have encountered any coding problems in the JS interview, please raise a PR to add your solution to [`examples/`](./examples) folder**. Please refer to the [contributing](#contributing) section to learn more. 6 | 7 | For any queries, feel free to reach out to me — [topmate.io/vinitshahdeo](https://topmate.io/vinitshahdeo) or [Twitter](https://twitter.com/Vinit_Shahdeo). 8 | 9 | [![Twitter URL](https://img.shields.io/twitter/url?label=Share%20on%20Twitter&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Furl%3Dhttps%253A%252F%252Fgithub.com%252Fvinitshahdeo%252FJavaScript-Resources%252F%26text%3DCurated%2520list%2520of%2520resources%2520by%2520%40Vinit_Shahdeo%2520to%2520ace%2520your%2520next%2520JavaScript%2520interview.%26hashtags%3Djavascript%252C%2520interviews%252C%2520resoucres)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fvinitshahdeo%2FJavaScript-Resources%2F&text=Curated%20list%20of%20resources%20by%20@Vinit_Shahdeo%20to%20ace%20your%20next%20JavaScript%20interview.&hashtags=javascript%2Cinterviews%2Cresources) 10 | 11 | ## External Links 12 | 13 | - [Namastey JavaScript Course](https://www.youtube.com/watch?v=pN6jk0uUrD8) - An awesome playlist of advanced concepts in JS **(Must watch)** 14 | - [FAQs for JavaScript Interviews](https://www.interviewbit.com/javascript-interview-questions/) **(Must do)** 15 | - Checkout [`examples/`](./examples) for coding problems in JS 16 | 17 | ## Repositories on GitHub 18 | 19 | [![JavaScript Questions](https://github-readme-stats.vercel.app/api/pin/?username=lydiahallie&repo=javascript-questions)](https://github.com/lydiahallie/javascript-questions) 20 | 21 | [![Important JS Concepts](https://github-readme-stats.vercel.app/api/pin/?username=leonardomso&repo=33-js-concepts)](https://github.com/leonardomso/33-js-concepts) 22 | 23 | [![Tricky JS problems](https://github-readme-stats.vercel.app/api/pin/?username=denysdovhan&repo=wtfjs)](https://github.com/denysdovhan/wtfjs) 24 | 25 | [![JavaScript Dev Bookmarks](https://github-readme-stats.vercel.app/api/pin/?username=didicodes&repo=javascript-dev-bookmarks)](https://github.com/didicodes/javascript-dev-bookmarks) 26 | 27 | [![Modern JS Cheatsheet](https://github-readme-stats.vercel.app/api/pin/?username=mbeaudru&repo=modern-js-cheatsheet)](https://github.com/mbeaudru/modern-js-cheatsheet) 28 | 29 | [![Event loop in JavaScript](https://github-readme-stats.vercel.app/api/pin/?username=vinitshahdeo&repo=Event-Loop-In-JavaScript)](https://github.com/vinitshahdeo/Event-Loop-In-JavaScript) 30 | 31 | [![Clean code in JavaScript](https://github-readme-stats.vercel.app/api/pin/?username=ryanmcdermott&repo=clean-code-javascript)](https://github.com/ryanmcdermott/clean-code-javascript) 32 | 33 | [![Algorithms in JS](https://github-readme-stats.vercel.app/api/pin/?username=trekhleb&repo=javascript-algorithms)](https://github.com/trekhleb/javascript-algorithms) 34 | 35 | ## Contributing 36 | 37 | 1. Clone the repository and create a new branch. 38 | 39 | ```bash 40 | git clone https://github.com/vinitshahdeo/inspirational-quotes.git 41 | git checkout -b feature/ 42 | ``` 43 | 44 | 2. Head to `examples` folder 45 | 46 | ```bash 47 | cd examples 48 | touch yourFileName.js 49 | ``` 50 | 51 | 3. Add your code to `yourFileName.js` 52 | - Ensure that the problem statement is added as a comment in the top of the file. 53 | - Add proper comments (JSDocs) wherever needed. 54 | - Below is a sample code snippet 55 | 56 | ```js 57 | 58 | /** 59 | * 60 | * Flatten the given array 61 | * Input: [1,2,[3,4,[5,6]],7,8,[9,10]] 62 | * Output: [1,2,3,4,5,6,7,8,9,10] 63 | * 64 | */ 65 | const flattenArray = (arr) => { 66 | let flattenedArray = []; 67 | arr.forEach((item) => { 68 | if (Array.isArray(item)) 69 | flattenedArray.push(...flattenArray(item)); 70 | else 71 | flattenedArray.push(item); 72 | }); 73 | return flattenedArray; 74 | }; 75 | 76 | console.log(flattenArray([1, 2, [3, 4, [5, 6, 7]], 8])); 77 | 78 | ``` 79 | 80 | 4. Please raise a [pull request](https://github.com/vinitshahdeo/JavaScript-Resources/pulls) to add your code-snippet. 81 | - Provide proper PR title and description. 82 | - Sit and relax! You've made your contribution. 🎉 83 | 84 | [![Forkers repo roster for @vinitshahdeo/JavaScript-Resources](https://reporoster.com/forks/vinitshahdeo/JavaScript-Resources)](https://github.com/vinitshahdeo/JavaScript-Resources/network/members) 85 | 86 | ## Thank you 87 | 88 | Initially I have curated these resources for my mentees, but it's now a community-led initiative to gather best resources to ace any JS interview. If you like it, kindly consider [leaving a star](https://github.com/vinitshahdeo/JavaScript-Resources/stargazers) or [buying me a coffee](https://www.buymeacoffee.com/vinitshahdeo)! [Tweet](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fvinitshahdeo%2FJavaScript-Resources%2F&text=Curated%20list%20of%20resources%20by%20@Vinit_Shahdeo%20to%20ace%20your%20next%20JavaScript%20interview.&hashtags=javascript%2Cinterviews%2Cresources) to spread a word. 89 | 90 | [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/vinitshahdeo) 91 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-modernist -------------------------------------------------------------------------------- /examples/currying.js: -------------------------------------------------------------------------------- 1 | /** 2 | * multiply(a)(b)(c)....(n)() should return the product of all the numbers a*b*c*..*n. 3 | * 4 | * For example, multiply(1)(2)(3)() = 6 5 | * 6 | */ 7 | 8 | // ES5 Solution 9 | function mul(a) { 10 | return function (b) { 11 | if (!b) return a; 12 | return mul(a * b); 13 | }; 14 | } 15 | 16 | // ES6 Solution 17 | const multiply = (a) => { 18 | return (b) => { 19 | if (!b) return a; 20 | return multiply(a*b); 21 | } 22 | } 23 | 24 | // one-liner solution 25 | const multiplication = a => b => b ? multiply(a*b) : a 26 | -------------------------------------------------------------------------------- /examples/debounce.js: -------------------------------------------------------------------------------- 1 | // Originally inspired by David Walsh (https://davidwalsh.name/javascript-debounce-function) 2 | 3 | // Returns a function, that, as long as it continues to be invoked, will not 4 | // be triggered. The function will be called after it stops being called for 5 | // `wait` milliseconds. 6 | const debounce = (func, wait) => { 7 | let timeout; 8 | 9 | // This is the function that is returned and will be executed many times 10 | // We spread (...args) to capture any number of parameters we want to pass 11 | return function executedFunction(...args) { 12 | 13 | // The callback function to be executed after 14 | // the debounce time has elapsed 15 | const later = () => { 16 | // null timeout to indicate the debounce ended 17 | timeout = null; 18 | 19 | // Execute the callback 20 | func(...args); 21 | }; 22 | // This will reset the waiting every function execution. 23 | // This is the step that prevents the function from 24 | // being executed because it will never reach the 25 | // inside of the previous setTimeout 26 | clearTimeout(timeout); 27 | 28 | // Restart the debounce waiting period. 29 | // setTimeout returns a truthy value (it differs in web vs Node) 30 | timeout = setTimeout(later, wait); 31 | }; 32 | }; 33 | -------------------------------------------------------------------------------- /examples/flattenArray.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Flatten the given array 4 | * Input: [1,2,[3,4,[5,6]],7,8,[9,10]] 5 | * Output: [1,2,3,4,5,6,7,8,9,10] 6 | * 7 | */ 8 | const flattenArray = (arr) => { 9 | let flattenedArray = []; 10 | arr.forEach((item) => { 11 | if (Array.isArray(item)) 12 | flattenedArray.push(...flattenArray(item)); 13 | else 14 | flattenedArray.push(item); 15 | }); 16 | return flattenedArray; 17 | }; 18 | 19 | console.log(flattenArray([1, 2, [3, 4, [5, 6, 7]], 8])); 20 | --------------------------------------------------------------------------------