JavaScript facts — get basic knowledge
This weekend , Mr Vimal Daga sir and Preeti ma’am had arranged a free Live Workshop on javascript. It was conducted by the world record holder Mr. Vimal Daga .
We came across many new conceptual things and terminology. It was overall a great experience. While attending the session we came to alot of concepts.
Session Briefing
👉 Programming Language is the role of the browser other than accessing the website. Browser can interpret HTML, CSS and JavaScript code.
👉 An event refers to an action or occurrence that happens in the system you are programming. The system then notifies you about the event so that you can respond to it in some way if necessary.
👉 There are following three ways in which users can add JavaScript to HTML pages: Embedding code,Inline code and external file.
👉 A JavaScript framework is a collection of JavaScript code libraries that provide developers with pre-written code for routine programming tasks. Frameworks are structures with a particular context. Examples:- Angular, React, Vue, Node.js, etc.
👉 The <div> tag defines a division or a section in an HTML document. The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript. The <div> tag is easily styled by using the class or id attribute.
👉 document.getElementById("myPara") will return our html element as a javascript object which has pre-defined property innerHTML. innerHTML property contains the content of HTML tag.
👉 Onclick event occurs when we click any element on that page
Mouseover event occurs when mouse just hovers over that element.
Mouseout event occurs when mouse stop hovering over that element
👉 JS supports different types of boxes:
1) Alert
2) Confirm
3) Prompt
👉 BOM or Browser Object Model is the
browser specific things that are available for JS to use and manipulate.qq
👉 We can also integrate CSS and JS using certain properties. When we get the element using ID then we can use the style property
and the different attributes under it like border, background-color, etc.
👉 When we suppose use Alert box in another function and suppose we have another function that fetches data from another website then when either of the function runs then JS holds the page till that function ends. This makes the page unresponsive. So we need to use the concept of AJAX(Asynchronous JAvascript Xml).
👉 Whenever we want some data from the
backend servers then we send request to the server. Now the server will run some operations on the backend and then provide the data to us. This data is called as response.
👉 To send a request using Javascript we can use XMLHttpRequest() function.
👉 Synchronous is when we want functions to run one after the other. In this way then if one function takes long time to get the response then the page becomes unresposive. Thus we need to go for asynchronous functions such that this function will go and wait for the response while the page will be responsive and be able to run other functions as well.
👉 JSON stands for JavaScript Object Notation and its syntax is pretty much similar to map or dictionary. It basically stores values in key value pair.
We can use JSON with JS
var obj =JSON. parse(text)
👉 The GET methods is used to get the query string whereas the POST method is used for create operation on the backend.
👉 The output that comes from the backend is formatted in some manner but for HTML it will be seen as just one line. So we can use pre tag in HTML to pre-format the text.