# Techinical Interview Questions
## JavaScript
- ==What is JavaScript?==
JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object based Programming language.
- ==What are JavaScript Data Types?==
Number, String ,Boolean, null , undefined ,Object ,Symbol
[the most useful resorse about **type of**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof)
- ==Higher Order Functions==
A callback function, is a function that is passed as an argument to another function. A higher-order function is a function that takes a callback or return another function.
- ==Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any?==
Timers are used to execute a piece of code at a set time or also to repeat the code in a given interval of time. This is done by using the functions setTimeout, setInterval and clearInterval.
The setTimeout(function, delay) function is used to start a timer that calls a particular function after the mentioned delay. The setInterval(function, delay) function is used to repeatedly execute the given function in the mentioned delay and only halts when cancelled. The clearInterval(id) function instructs the timer to stop.
Timers are operated within a single thread, and thus events might queue up, waiting to be executed.
- ==What is called Variable typing in Javascript?==
Variable typing is used to assign a number to a variable and the same variable can be assigned to a string.
Example
i = 10;
i = "string";
This is called variable typing.
- ==What are escape characters?==
Escape characters (Backslash) is used when working with special characters like single quotes, double quotes, apostrophes and ampersands. Place backslash before the characters to make it display.
Example:
document.write "I m a "good" boy"
document.write "I m a \"good\" boy"
- ==What are JavaScript Cookies?==
Cookies are the small test files stored in a computer and it gets created when the user visits the websites to store information that they need. Example could be User Name details and shopping cart information from the previous visits.
- ==What is break and continue statements?==
Break statement exits from the current loop.
Continue statement continues with next statement of the loop.
- ==What are the two basic groups of dataypes in JavaScript?==
They are as –
Primitive
Reference types.
Primitive types are number and Boolean data types. Reference types are more complex types like strings and dates.
- ==Which keywords are used to handle exceptions?==
Try… Catch---finally is used to handle exceptions in the JavaScript
Try{
Code
}
Catch(exp){
Code to throw an exception
}
Finally{
Code runs either it finishes successfully or after catch
}
- ==What are the different types of errors in JavaScript?=
There are three types of errors:
Load time errors: Errors which come up when loading a web page like improper syntax errors are known as Load time errors and it generates the errors dynamically.
Run time errors: Errors that come due to misuse of the command inside the HTML language.
Logical Errors: These are the errors that occur due to the bad logic performed on a function which is having different operation.
- ==How will you explain closures in JavaScript? When are they used?==
Closure is a locally declared variable related to a function which stays in memory when the function has returned
## Functions
- ==callback function==
```
A function that is passed as an argument to another function
```
- ==higher-order function==
```
A function that takes another function as an argument
and/or returns a function
```
- ==what are pure functions?==
```
1- it's the functions that always returns the same result from the same arguments.
2- and has no side effects.
```
for more : https://github.com/ali-7/ws-pure-functions-easy-testing
## React
```js=
import React from 'react'
```
- `react` is a javascript library, we import `react` npm package"
- react used for single page application:

- ==Server Side vs Client Side==
https://www.freecodecamp.org/news/what-exactly-is-client-side-rendering-and-hows-it-different-from-server-side-rendering-bd5c786b340d/
- ==Babel and Webpack== : https://dev.to/getd/wtf-are-babel-and-webpack-explained-in-2-mins-43be
- ==Differentiate between Real DOM and Virtual DOM.==

- ==What's the different between npm vs npx?==
npx: downloads and executes Node.js commands without installing them. it comes with `npm` since v5.2
"`npx create-react-app <app-name>` it downloads the recent version of create-react-app relaese,run it, then it removes it from your system"
- ==what is JSX ?==
- JSX is a special language we use to build a component's output.
- Under the hood, React will process the JSX and it will transform it into JavaScript that the browser will be able to interpret.
- React gives us this interface for one reason: it's easier to build UI interfaces using JSX.
### ==React Resources==
- https://dev.to/hamza/framework-vs-library-vs-package-vs-module-the-debate-3jpp
- https://www.edureka.co/blog/interview-questions/react-interview-questions/
- https://github.com/sudheerj/reactjs-interview-questions
## React Hooks
https://github.com/gazaskygeeks/code-academy-workshops/tree/master/workshops/hooks-ws
intro to React Hooks video
https://reactjs.org/docs/hooks-intro.html

- ==higher-order component==
```
A higher-order component (HOC) is an advanced technique in React
for reusing component logic.
```
read more : https://reactjs.org/docs/higher-order-components.html
- https://www.robinwieruch.de/react-hooks-higher-order-components
## JSON
JSON is a way to store information that's organised and easy to access. It looks like a JavaScript object but its keys and values are always strings before parsing. Once parsed it's values could be string, number, boolean, object, array or null
- JSON has two methods to convert strings to JSON objects and back again :
1. **let string = JSON.stringify(object)**
2. **let object = JSON.parse(string)**
## Node.js
https://github.com/foundersandcoders/npm-introduction
- ==what is the difference between node.js and js?==
```
js is a programming languge runs in a browser ,
node.js is a running inviromant for js use v8 angine
and it's for the backend helps us do the server side
etc ..
```
https://www.geeksforgeeks.org/difference-between-node-js-and-javascript/
- ==The difference between “require(x)” and “import x”==
```
The major difference between require and import, is that require
will automatically scan node_modules to find modules, but import,
which comes from ES6, won't.
so :
Most people use babel to compile import and export, which makes
import act the same as require.
```
https://stackoverflow.com/questions/46677752/the-difference-between-requirex-and-import-x
## Express.js
## HTTP
https://github.com/ali-7/api-workshop/blob/master/02-http.md
The Hypertext Transfer Protocol (HTTP) is the mechanism through which data is requested and provided on the World Wide Web.
### HTTP methods
- GET
- POST
- PUT
- DELETE
### HTTP status codes
Status codes accompany a server response to indicate whether the request was successful. They are made up of a three-digit number and a human-readable phrase, eg 200 OK or 404 Not Found.
## xhr
https://github.com/ali-7/api-workshop/blob/master/03-xmlhttprequest.md
It's important that you know that an XMLHttpRequest (XHR) is an object. You can create an instance of XHR using an object constructor as follows: `let xhr = new XMLHttpRequest()`
```js=
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
document.getElementById("demo").innerHTML =
xhr.responseText;
}
};
xhr.open("GET", "xmlhttp_info.txt", true);
xhr.send();
```
## REST API
## POSTGRESQL
## HTML
## CSS
## TDD
https://github.com/mossa-Sammer/testing-tdd-intro
- ==What is Test-driven Development?==
TDD is a methodology for writing code where you write the tests before your functions. This way you are forced to really think through exactly what you want your code to do (i.e. what values your function takes and returns) before you start writing it. It's like planning an essay (if your plan could also tell you if you've got the right answer).
You also end up with a complete test-suite for your code as soon as you're finished. This is valuable because it's harder to go back and write tests once you're done (especially if you don't do it right away).
This is also called the Red-Green-Refactor cycle of T

- ==**Pure functions**==
https://github.com/ali-7/ws-pure-functions-easy-testing
## NEXT.js
## Authentication and validation
## Redux
## Firebase
## UI/UX
## TypeScript