Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
After teaching React extensively (33.000+ students), be it online for a larger audience or on-site for companies transitioning to web development and React, I always come to the conclusion that React is all about JavaScript. Most of it boils down to JavaScript ES6 and beyond features and syntax, but also ternary operators, shorthand versions in the language, the ‘this’ object, JavaScript built-in functions (map, reduce, filter) or more general concepts such as composability, reusability, immutability or higher-order functions. While you don’t need necessarily to master all of these before starting with React, they will come up while practicing it and so to learn them will put you at a great advantage.
This course is my attempt to give you comprehensive JavaScript skills that will make your React journey smooth and straight-forward.
Q1. You can add new properties to an instance object any time later after its creation. True or False?
Q2. The most recommended way of declaring a variable is using:
Q3. Which of these are accessible throughout the code:
Q4. What will be the output of the following code snippet?
const student = {
ID: '21',
name: 'Jhon',
GPA: '3.0',
};
const {GPA:n} = student;
console.log(n);
Q5. Automatic type conversion is supported by JavaScript. Is this statement True or False?
Rewrite the cube()
function given using a ‘function expression’. It can be named or anonymous but remember to name the object (i.e., var
etc) cube
or your code won’t compile.
var cube = function(n) {
return n*n*n;
}
Rewrite the given square function using arrow functions. Again, remember to name it square
or your code won’t compile.
var square = n => n*n;
In the following, write a program using the map function that squares the numbers in the hidden given array called notSquared
. It contains random integers.
Note:
squared
or your code won’t compile.squared
.squared = notSquared.map( n => n*n );
Q1. A function passed into another function as an argument is called:
Q2. A function that returns an iterator using yeild
keyword is called:
Q3. What would the following code do?
render(){
let users = [
{ 'name' : 'Elton Jhon', 'age' : 60 },
{ 'name' : 'Elvis Persley', 'age' : 50 },
{ 'name' : 'Kurt Cobain', 'age' : 24}
];
return (<div>
{users.map(user => <p>{user.name}</p>)}
</div>)
}
Q4. What would this code do?
function coolFunction(val){
return val? "Cool" : "Not Cool";
}
var val = true;
val
Q5. What would the following function do?
function myFunction(my_array){
return my_array.filter(function(num, position)){
return my_array.indexOf(num) == position;
}
}
In the following coding challenge, write a class in JavaScript that describes a car with the properties color
, model
, engineCap
(engine capacity), and registrationNum
registration number and methods getColor()
, getModel()
, setColor()
, and setModel()
. Remember to use the exact spelling given here or your code won’t pass.
class Car {
constructor(color, model, engineCap, registrationNum) {
this.color = color;
this.model = model;
this.engineCap = engineCap;
this.registrationNum = registrationNum;
}
getColor() {
return this.color;
}
getModel() {
return this.model;
}
setColor(Color) {
this.color = Color;
}
setModel(Model) {
this.model = Model;
}
}
let me = {
firstname: "Robin",
getName: function(){
console.log(this.name);
}
}
// You have to bind the function to the object because just assigning it to a var
// ... is equivalent to assigning a standalone function to a var
var getMyName = me.getName.bind(me);
getMyName();
Q1. In JavaScript, this
keyword refers to:
Q2. JavaScript classes are basically objects. Is this statement True or False?
Q3. ES6 does not support overriding. Is this statement True or False?
Q4. Explicit binding occurs when dot notation is used to invoke a function. Is this statement True or False?
Q5. When we use call()
on a fuction, the type of binding that occurs is:
Q1. Which of these scenarios best explain Modularity:
Q2. The intellisense suggested modules are actually dependencies that exist in:
Q3. While importing a module in a file, we specify its path from:
Q4. The modules that are imported without using the path symbol are actually:
Q5. Which of the following keyword is used to rename the module while importing it
nameas
alias
as
namedas
Q1. What is a React component in JavaScript?
Q2. There is a method in React component which is overidden to prevent updating the components. Which of the following is that method?
componentDidUpdate
shouldComponentUpdate
componentNotUpdate
componentShouldUpdate
Q3. The data is passed to a component through:
render()
setState()
Q4. How would you write a JavaScript function inside JSX?
<p>{function()}</p>
<p>${function}</p>
<p>${function}$</p>
<p>{function}</p>
Q5. Calling setState
method inside render()
does not generate any errors. Is this statement True or False?
Q6. JSX is not a type-safe language. Is this statement True or False?
Q7. The main purpose of using lifecycle methods is:
Q8. What happens when you make multiple setState()
calls within a function?
setState
callsQ9. Can components refer to other components? Answer in yes or no.
Q10. The main focus of React is:
Q11. The div
element that is defined inside a render method is an actual DOM element. Is this statement true or false?
I hope this JavaScript Fundamentals Before Learning React Educative Quiz Answers would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>