10 crush thing of javascripts
1. Simple terms of javascript
JavaScript is a programming language commonly used in web development. It was originally developed by Netscape. And it used for dynamic and interactive elements to websites.
2. Javascript executes
javaScript is most often run on web pages inside the browser, but it can also be run server-side.
To execute JavaScript in a browser you have two options — either put it inside a script element anywhere inside an HTML document or put it inside an external JavaScript file (with a . js extension) and then reference that file inside the HTML document using an empty script element with an src attribute.
3. DOM
The DOM (Document Object Model) is an interface that represents that how Core, HTML, and XML documents are read by the browser. It allows a language (JavaScript) to manipulate, structure, and style on website.
4. JavaScript Function Scope
In JavaScript, there are two types of scope: Local scope, Global scope
LOcal scope/variable used inside the function and it can used inside the functoion.
Global scope/variable used outside the function and it can access form anywhere.
5. Event LOOP work
The event loop works by making a request to some internal or external “event provider” then calls the relevant event handler.
6. The way of event bubble
When an event happens on an element, At first it runs on the handlers and then on its parent, then all the way up on other ancestors.
The most deeply nested element that caused the event is called a target element, accessible as the event.
7. arrow function, multiple parameter functions
Arrow function is one of the best features in the ES6 version of JavaScript. It allows you to create functions more cleaner than a regular function
more…
8. This keyword
Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier.
9. Use callback functions
Callbacks make sure that a function is not going to run before a task is completed but will run right after the task has been completed. It helps us develop asynchronous JavaScript code and keeps us safe from problems and errors.
10.difference between bind call and apply in javascript..
Bind(): returns a new function, allowing you to pass in an array and any
Call( ): The call() method invokes a function with a given ‘this’ value and arguments provided one by one.
Apply( ): Invokes the function and allows you to pass in arguments as an array. …