Thursday, April 22, 2021

HTML5 question and answer

What Is doctype in html 5
A Document Type Declaration, or DOCTYPE for short, is an instruction to the web browser about the version of markup language in which a web page is written. A DOCTYPE declaration appears at the top of a web page before all other elements. ... The DOCTYPE for HTML5 is very short, concise, and case-insensitive.

What is difference between SVG and Canvas
SVG stands for Scalable Vector Graphics. SVG and useful for defining graphics such as boxes, circles, text, etc. The HTML canvas element is used to draw graphics, via JavaScript. The element is a container for graphics.

What is WebSocket
What is geo location
What is Canvas
Tell me about What is Multimedia?tag
What is WebSocket
can you tell about nested pages

Tuesday, April 20, 2021

React.js Interview Question and Answer

What is React
React is a JavaScript library created for building fast and interactive user interfaces for web and mobile applications. It is an open-source, component-based, front-end library responsible only for the application’s view layer. In Model View Controller (MVC) architecture, the view layer is responsible for how the app looks and feels. React was created by Jordan Walke, a software engineer at Facebook.

Why react:
It has huge community of github Components base architecture
React Features
React’s popularity today has eclipsed that of all other front-end development frameworks. Here is why:
Easy creation of dynamic applications: React makes it easier to create dynamic web applications because it requires less coding and offers more functionality, as opposed to JavaScript, where coding often gets complex very quickly. • Improved performance: React uses Virtual DOM, thereby creating web applications faster. Virtual DOM compares the components’ previous states and updates only the items in the Real DOM that were changed, instead of updating all of the components again, as conventional web applications do.
Reusable components: Components are the building blocks of any React application, and a single app usually consists of multiple components. These components have their logic and controls, and they can be reused throughout the application, which in turn dramatically reduces the application’s development time.
Unidirectional data flow: React follows a unidirectional data flow. This means that when designing a React app, developers often nest child components within parent components. Since the data flows in a single direction, it becomes easier to debug errors and know where a problem occurs in an application at the moment in question.
Small learning curve: React is easy to learn, as it mostly combines basic HTML and JavaScript concepts with some beneficial additions. Still, as is the case with other tools and frameworks, you have to spend some time to get a proper understanding of React’s library.
It can be used for the development of both web and mobile apps: We already know that React is used for the development of web applications, but that’s not all it can do. There is a framework called React Native, derived from React itself, that is hugely popular and is used for creating beautiful mobile applications. So, in reality, React can be used for making both web and mobile applications.
Dedicated tools for easy debugging: Facebook has released a Chrome extension that can be used to debug React applications. This makes the process of debugging React web applications faster and easier.


What is hooks
Hooks are introduce in version 16.8 we used recycling method before that like class but basically hooks replaced the classes method to function components , we use useState and usestate a array return current data and updated data = initial data

What is jsx

JSX stands for JavaScript XML. JSX allows us to write HTML in React. JSX makes it easier to write and add HTML in React. Babel compiles JSX down to send compile data to browser What is render() method in react.js React, the render() method is the only required method in a class component, and is responsible for describing the view to be rendered to the browser window

What is render and return method
Render is a method that tell react what to display. Return is a method / give output of function render is a method of react. return is just pure javascript for returning output. ... In react, render is a method that tell react what to display. return in a method or function is the output of the method or function

What is arrow function:-
Arrow functions were introduced in ES6. Arrow functions allow us to write shorter function syntax Const sum = ()=>{ }

What is Event
Handling events with React elements is very similar to handling events on DOM elements. There are some syntax differences: React events are named using camelCase, rather than lowercase. With JSX you pass a function as the event handler, rather than a string.

What is the use of virtual Dom in react JS?
Virtual dom is clone of Real dom we can do something in react pages its kept in virtal dome and after that it sync with real dom The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM. This process is called reconciliation.

what is controled and uncontroled components? In a controlled component, form data is handled by a React component. The alternative is uncontrolled components, where form data is handled by the DOM itself. To write an uncontrolled component, instead of writing an event handler for every state update, you can use a ref to get form values from the DOM.
An input form element whose value is controlled by React in this way is called a “controlled component”. For example, if we want to make the previous example log the name when it is submitted, we can write the form as a controlled component: class NameForm extends React. An input form element whose value is controlled by React in this way is called a “controlled component”.

What is State
State use in react you can update your data use state You cant update your date via variable

What is functional components
A Functional component is a function that takes props and returns JSX. They do not have state or lifecycle methods. Functional components are easier to read, debug, and test. They offer performance benefits, decreased coupling, and greater reusability.

Monday, April 19, 2021

JavaScript Interview Questions and Answers for

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

Differences between declaring variables using var, let and const.
var declarations are globally scoped or function scoped while let and const are block scoped. var variables can be updated and re-declared within its scope; let variables can be updated but not re-declared; const variables can neither be updated nor re-declared. They are all hoisted to the top of their scope.



What is difference between Null and Undifine or Nan
null is an assigned value. It means nothing. undefined means a variable has been declared but not defined yet nan is not a number if you divide integer to strings then you get Nan

What is DOM?
DOM stands for Document Object Model. DOM is a programming interface for HTML and XML documents. When the browser tries to render a HTML document, it creates an object based on the HTML document called DOM. Using this DOM, we can manipulate or change various elements inside the HTML document. Example of how HTML code gets converted to DOM:

What is JSON?
JavaScript Object Notation JSON is a format for storing and transporting data. JSON is often used when data is sent from a server to a web page.

What is closure in javascript:- Closure is inner function that has access to the outer function variable
What Is ajax
AJAX = Asynchronous JavaScript And XML. AJAX allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page. function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("demo").innerHTML = this.responseText; } }; xhttp.open("GET", "ajax_info.txt", true); xhttp.send(); }

Whati is && and ||
&& both condition should be true || both condition should be true and 1 condition should be true

What is Web API?
Examples: Application program interface YouTube API - Allows you to display videos on a web site. Twitter API - Allows you to display Tweets on a web site. Facebook API - Allows you to display Facebook info on a web site.

What is prototype in java script:
Prototype is help to obj to create multiple object use constructor its included default in java script

What is the rest parameter and spread operator?
Both rest parameter and spread operator were introduced in the ES6 version of javascript. Rest parameter ( … ) Any number of arguments will be converted into an array using the rest parameter. Rest parameter can be used by applying three dots (...) before the parameters.

What is classes
Class methods are created with the same syntax as object methods. Use the keyword class to create a class. Always add a constructor() method.

What Is Hoisting?
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution.

what is JavaScript Closures
JavaScript variables can belong to the local or global scope. Global variables can be made local (private) with closures.

What is difference between forEach and forloop;
the forEach method is a little cleaner than the for loop.In a forEach method, we pass each food type within that iteration into the callback. A for loop needs you to access the array using a temporary i variable. While might not seem very messy in the beginning, it can get more cluttered when you begin to add more code.

What Is Promise?
Fulfilled= resolve Rejected= reject fetch(url) then(process) then(save) catch(handleErrors)

What are JavaScript Data Types?
Following are the JavaScript Data types: • Number • String • Boolean • Object • Undefined What is the use of isNaN function?
• isNan function returns true if the argument is not a number otherwise it is false.

What is negative infinity?
• Negative Infinity is a number in JavaScript which can be derived by dividing negative number by zero.

What is 'this' keyword in JavaScript?
This' keyword refers to the object from where it was called.

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 How can you convert the string of any base to integer in JavaScript?

what is call back function?
Explain the difference between "==" and "==="?
"==" checks only for equality in value whereas "===" is a stricter equality test and returns false if either the value or the type of the two variables are different.

What would be the result of 3+2+"7"?
Since 3 and 2 are integers, they will be added numerically. And since 7 is a string, its concatenation will be done. So the result would be 57.

What do mean by NULL in Javascript?
The NULL value is used to represent no value or no object. It implies no object or null string, no valid boolean value, no number and no array object.

What is the use of Void(0)?
Void(0) is used to prevent the page from refreshing and parameter "zero" is passed while calling. Void(0) is used to call another method without refreshing the page.

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. Describe the properties of an anonymous function in JavaScript? var anon = function() { alert('I am anonymous'); }; anon();

What boolean operators can be used in JavaScript?
The 'And' Operator (&&), 'Or' Operator (||) and the 'Not' Operator (!) can be used in JavaScript. *Operators are without the parenthesis. what is empty array
var str = [1,3,5,6]; str = []; console.log(str)

what is anonymous function what is the use of javascript
anonymous function has no name between the function keyword and parentheses () . Because we need to call the anonymous function later, we assign the function to the show variable.
Var a = function(){ Document.write(“welcom”) } A()
What's the difference between call and apply and bind `?
Fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments. The difference is that call() takes the function arguments separately, and apply() takes the function arguments in an array. Difference between call() and apply() method: The only difference is call() method takes the arguments separated by comma while apply() method takes the array of arguments. bind(something) returns a new function, in which references to this will refer to something . This is a way of saving the current value of this , which is in scope during the call to the constructor, so that it can be used later when the function is called

What are undeclared and undefined variables?
Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable, then a runtime error is encountered. Undefined variables are those that are declared in the program but have not been given any value. If the program tries to read the value of an undefined variable, an undefined value is returned.

Write the code for adding new elements dynamically?
function addNode () { var newP = document. createElement("p"); var textNode = document.createTextNode(" This is a new text node"); newP.appendChild(textNode); document.getElementById("firstP").appendChild(newP); }

What is the use of Void (0)?
Void(0) is used to prevent the page from refreshing, and parameter "zero" is passed while calling. Void(0) is used to call another method without refreshing the page.

What are JavaScript Cookies?
Cookies are the small test files stored in a computer, and they get created when the user visits the websites to store information that they need. Examples could be User Name details and shopping cart information from previous visits.

What a pop()method in JavaScript is?
The pop() method is similar to the shift() method, but the difference is that the Shift method works at the array's start. The pop() method takes the last element off of the given array and returns it. The array on which it is called is then altered. Example: var cloths = ["Shirt", "Pant", "TShirt"]; cloths.pop(); //Now cloth becomes Shirt,Pant

What is the use of the Push method in JavaScript?
The push method is used to add or append one or more elements to an Array end. Using this method, we can append multiple elements by passing multiple arguments.

What is the unshift method in JavaScript?
Unshift method is like the push method, which works at the beginning of the array. This method is used to prepend one or more elements to the beginning of the array.

what is opps in javascript