ReactJS Flashcards
To learn ReactJS
What is Babel
It is a JavaScript compiler used to ensured backward compatibility of Javascript(ES6) code
What does the command does
It is same as . It installs a package and all the dependencies present in package.json
What’s the difference between npm install –save and npm install
using –save option updates package.json
How is CSS property written(set) in Javascrit
Any hyphenated CSS property will be written in camelCase in JavaScript
What are the three kinds of nodes in DOM
Element nodes, text nodes and comment nodes
method to access elements by tag
document.getElementsByTagName()
selector for ID attribute with querySelector method
# Example document.querySelector('demo-query')
Selector for class attribute with querySelector method
.
Example document.querySelector(‘.demo-query-all’)
How to comma separated values function in querySelector() method
comma separated values function as an OR operator. for example querySelector(‘div,article’) will match div or article, whichever occurs first in the document
How to comma separated values function in querySelectorAll() method
comma separated values function as an AND operator. for example querySelectorAll(‘div, article’) will match all divs and articles in the document
how to retrieve the grandparent node
childElement.parentNode.parentNode
Which child node properties will fetch only the element nodes
children, firstElementChild and lastElementChild
What method can be used to create a new HTML element in Javascript
document.createElement
how do you add text to your html element
.textContent or .innerHTML
InnerHTML method can be used to insert both text and HTML to a node but has Cross Site Scripting risk.
Method to create a text node
document.createTextNode()