Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sumanbiswas7/javascript-interview
javascript interview questions, answers and resources written in typescript :)
https://github.com/sumanbiswas7/javascript-interview
interview javascipt
Last synced: 28 days ago
JSON representation
javascript interview questions, answers and resources written in typescript :)
- Host: GitHub
- URL: https://github.com/sumanbiswas7/javascript-interview
- Owner: sumanbiswas7
- Created: 2022-08-05T16:16:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-08T03:50:09.000Z (over 2 years ago)
- Last Synced: 2024-05-29T22:20:36.768Z (7 months ago)
- Topics: interview, javascipt
- Language: TypeScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Javascript Interview
basic to intermediate level questions and answers, resources to prepare for javascript interview
## Table of contents
| No | Core concepts |
| --- | ------------------------------------------------------------------------- |
| 1 | [Check if the user exists in the given object](#Check-if-the-user-exists) |
| 2 | [Explain "this" keyword in javascript](#this-keyword-in-javascript) |
| 3 | [Regular expressions](#regular-expression-in-javascript) |## Answers
### Check if the user exists
```javascript
const users = [
{ name: "paul", age: 22 },
{ name: "jerry", age: 18 },
{ name: "rita", age: 25 },
{ name: "max", age: 21 },
{ name: "harry", age: 21 },
];
```to find if a given user exists in the users array we could use filter, loops, etc. but we only need true if the user exists or false if not. array.some() function can be the best option for dealing with this senario.
```javascript
users.some((user) => user.name === "paul"); //true
users.some((user) => user.name === "cillian"); //false
```
**[⬆ Back to Top](#table-of-contents)**### This keyword in javascript
in javascript this keyword represents the execution context, basically, the object that's calling the func, there are so many caveats to keep in mind please go through these articles below to get a good understanding of this.
1. [Beginner explaination of this](https://www.youtube.com/watch?v=gvicrj31JOM)
2. [Intermediate explanation of this](https://dmitripavlutin.com/gentle-explanation-of-this-in-javascript/)
**[⬆ Back to Top](#table-of-contents)**### Regular expression in javascript
Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. go through these resources below to get a good idea of Regex.
1. [Youtube video of Regex](https://www.youtube.com/watch?v=rhzKDrUiJVk&t=573s)
2. [Documentation Regex](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
**[⬆ Back to Top](#table-of-contents)**