Jun 01, 2021 Article blog
This article gives you a summary of a junior front-end job interview from an Internet company in Shanghai, hoping to help you.
A: Just answer normally.
A: Components:
React
components are
JS
are the JS part inside the function,
HTML
part of
return
and
Vue
I use a single-file component that consists of
HTML
templates,
JS
CSS
Props:
React
child component gets the external property passed by the parent component through
props
object passed in as a function argument, and the child component of
Vue
gets the external property passed by the parent component through the construction option
prop
state
:
React
declares and initializes the data through
useState
and gets
state
and
setState
updates the status to the view through
setState
and
Vue
declares the data via
data
option, modifying the data directly to the view.
A:
Vue
modifies the property to the
getter
and
setter
classes using
defineProperty
method for properties declared in the
data
option
Vue
listens to reads and writes of data through
getter
and
setter
types, and
Vue
re-renders components whenever the data changes.
A: You can listen for changes to data a through the
Watch
option, and then execute the corresponding code.
Q: This is really possible, what if you don't use
Watch
answer:...
A: Well, you can use
nextTick()
method to get the data and then determine whether a is equal to 456 and then execute the corresponding code.
A:
Vuex
is the global state management tool for
Vue
projects and has several core concepts:
answer:
{
var a = 1;
let b = 2;
}
console.log(a)
console.log(b)
A: Output: 1, error
console.log(a)
console.log(b)
{
var a = 1;
let b = 2;
}
A: Undefined, wrong
A: I understand.
A: I've described what Promise is, three states,
resolve
in a callback function, the role of
reject
and three instance methods,
.then
.catch
.finally
and two static methods,
.all
.race
A:
try catch
is also used to catch errors, And
Promise
has an error bubbling feature, and although
.then
returns a new object,
.catch
can still catch errors from the first
Promise
object after
.then
(I'm not sure if that's the right answer, and the interviewer didn't say anything)
A: I know (then I draw a diagram, the blue block represents the macro task queue, orange represents the microtask queue, the execution order is to perform the current horizontal synchronization task, then execute the horizontal microtask, and then execute the next horizontal macro task)
A:
Promise
returns microtasks
1.) Ask: Why Does Promise Return MicrotaskS?
A:
Promise
represents the return result of an asynchronous operation -> When the browser gets the results must want to process -> Joining a microtask queue is faster than macro task processing -> So join the microtask queue.
A: button is clicked - > child component event trigger -> parent component event trigger This is the bubbling mechanism of the event
A: There is also a capture mechanism,
addEventListener
defaults to a bubbling mechanism, which can be changed to capture by changing the third parameter to
true
A: (This answer varies according to the specific item, the specific answer content is not repeated here)
A: (It's best to prepare this question in advance, and the answers vary depending on the project and are not repeated)
1. If the interview question is more complicated, you can say first: Let me think about it a little, don't worry about answering.
2. Some problems end up in advance, such as: the most difficult problems in the project and solutions, which pits encountered, etc.
3. Basic knowledge is still very important, interviewer many questions will be based on the concepts you mentioned to expand, you'd better say every technical term you have a certain understanding.
Source: Public Number -- Frontman Author: Ghost Brother
The above is
W3Cschool编程狮
about the junior front-end job interview section of the relevant introduction, I hope to help you.