<script>
//ES5
{
var events = [1,3,4,5,6,7];
var odds =events.map(function (v) {
return v + 1
})
console.log(events,odds)
}
{
let events = [1,2,3,4,5];
let odds =events.map(v => v + 1);
console.log(events,odds)
}
{
var factory =function () {
this.a ='a';
this.b ='b';
this.c ={
a : "a+",
b:function () {
return this.a
}
}
}
console.log(new factory().c.b());
}
//ES6
{
var factory =function () {
this.a ='a';
this.b ='b';
this.c ={
a : "a+",
b: () => {
return this.a
}
}
}
console.log(new factory().c.b());
}
</script>
网友评论