标签:OLE script redux att return highlight 流程 web 数字
鹅厂前端面试
1.有代码如下
function test2(){
return 25;
};
console.log(typeof test2())
问题:写出此时打印出的值
number
2.现有代码如下:
var name=‘aaa‘;
var obj={
name:‘bbb‘,
dose:function(){
this.name=‘ccc‘;
}
};
var does=obj.dose;
does();
console.log(obj.name);
问题:写出此时打印的值
bbb
3.现有代码如下:
var a = 1;
var obj = {};
var fn=function(){};
function test(x,y,z){
x.a = 4;
y.b = 5;
z.c = 6;
return z;
}
test(a,obj,fn);
console.log(a+obj.b+fn.c);
问题:写出此时打印出的值,与严格模式下会出现的问题。
12,
4.现有如下代码:
var a=[1,2,3]; var b=a; b.push(4); console.log(a);
问:此刻a的值?若a的值是[1,2,3],则第二行代码如何优化?
a的值是[1,2,3,4]
5.编写一个函数向http://api.qq.com/api/query接口请求数据,并通过返回的数据判断调用是否成功(返回的数据格式与调用方式不限),请列出所有可行的方案。
6.写一个函数可以实现将数字类型的值格式化为千分位,并保留两位小数,如12345678.145可以格式化为123,456,789.14 , 112345678.156可以格式化为1,123,456,789.16 。
8.给出运行结果。
var someText=‘Web2.0‘; pattern=/(\w)(\d)\.(\d)/i; utCome=pattern.exec(someText); alert(utCome);
b2.0,b,2,0
9.写出下列程序运行结果。
import React from ‘react‘;
class Test extends React.Component<any,any>{
state={
count:0,
}
componentDidMount(){
this.setState({
count:this.state.count+1,
})
this.setState(preState=>{
return{count:preState.count+ 1 }
})
}
render(){
const{count}=this.state
console.log(count)
return<div>{count}</div>
}
}
10.用react实现一个confirm确认对话框组件,要求能够在大部分场景实现复用。
11.简述一下redux或vuex的工作流程。
标签:OLE script redux att return highlight 流程 web 数字
原文地址:https://www.cnblogs.com/hudunyu/p/12057568.html