xuyuan923 / dailyjs Goto Github PK
View Code? Open in Web Editor NEWJavaScript每日一练
JavaScript每日一练
/*
参数 number
返回 number
*/
function fib(num){
}
fib(1); // === 0
fib(2); // === 1
fib(3); // === 1
fib(4); // === 2
fib(5); // === 3
/*
* 在String对象的原型上创建一个方法,实现以下功能
* "String".reverse() // return "gnirtS"
* "Super awesome string here" //return "ereh gnirts emosewa repuS"
*
* */
String.prototype.reverse = function(){
};
//测试代码
"asdf".reverse() === "fdsa"
现在你有一个复杂的多重嵌套的对象,但是你莫名蛋疼,突然就不想用if obj.property == null
这个方法。于是乎打算,在Object
的原型上创建一个方法(prototype method),传递一个路径,返回undefined
或 值(value)
Object.prototype.hash = function(path){
}
var obj = {
person: {
name: 'joe',
history: {
hometown: 'bratislava',
bio: {
funFact: 'I like fishing.'
}
}
}
};
obj.hash('person.name'); // 'joe'
obj.hash('person.history.bio'); // { funFact: 'I like fishing.' }
obj.hash('person.history.homeStreet'); // undefined
obj.hash('person.animal.pet.needNoseAntEater'); // undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.