JavaScript Interview Questions and Answers (294) - Page 14

Which of the following is a valid type of function javascript supports?

NOTE: This is objective type question, Please click question title for correct answer.
Which built-in method returns the length of the string?

NOTE: This is objective type question, Please click question title for correct answer.
Which built-in method sorts the elements of an array?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following function of String object creates a string to blink as if it were in a <blink> tag?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following function of Array object removes the first element from an array and returns that element?

NOTE: This is objective type question, Please click question title for correct answer.
What will be the output of function square(x) { return x * x; } [ 4, 5, 8, 9 ].map(square); // gives: [ 16,25,64,81 ]

NOTE: This is objective type question, Please click question title for correct answer.
What is ReactJS

NOTE: This is objective type question, Please click question title for correct answer.
What is JSX?

NOTE: This is objective type question, Please click question title for correct answer.
Explain how the Components in ReactJS renders at the browser end.

ReactJS is a library and not a framework for the View Layer of a MV* pattern. It provides a template language known as JSX. The JSX is a kind of JavaScript syntax extension that is meant for expressing the UI design components in a much more readable way, very similar to XML syntax. Once the JSX is prepare, it is passed to the Render method of ReactJS and it is the Render function that hooks with ReactJS to bring the essential HTML which is the final React output. The Html/JSX being passed to Render function are call COMPONENTS in React terminology. These components store their own internal state inside the memory like updation of a textbox value, tab selection in a tab view control etc. Finally, by the Render method, the COMPONENTS are transformed into Html.
How to define multiple elements inside JSX ?

The Render method of ReactDOM returns a single node. We need to wrap the multiple child elements inside a parent element say DIV and retur a single node to the Render method. e.g.

<script type="text/babel">

ReactDOM.render(
<div>
<h1>Message from RNA Team - "Welcome to ReactJS World"</h1>
<b>Bold this text</b>
</div>,
document.getElementById('mainContainer')
);
</script>

What is Bable?

NOTE: This is objective type question, Please click question title for correct answer.
In which layer of MV* pattern, ReactJS fits into?

NOTE: This is objective type question, Please click question title for correct answer.
What does the render() method do in ReactJS?

It takes input data which is a Component and returns a string to display.e.g.

<div id="mountNode"></div>

var CustomMessage = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});

ReactDOM.render(<CustomMessage name="DNF" />, mountNode);


Output
----------

Hello DNF

What is a Component in ReactJS?

A component is that feature of React which comprises of an html along with it's associated JS satisfying the SRP principle.React components implement a render() method that takes input data as Component and returns the string after rendering as what to display. e.g.

<div id="mountNode"></div>

var CustomMessage = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});

ReactDOM.render(<CustomMessage name="DNF" />, mountNode);


Output
----------

Hello DNF

Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories