xxleyi / learning_list Goto Github PK
View Code? Open in Web Editor NEW聚集自己的学习笔记
聚集自己的学习笔记
代码主体来自同事大桃,我做了一些修改。😄😄😄
// 定义Person构造函数
function Person (name) {
this.name = name
this.sayHello = function(){
console.log('hello from person')
}
}
Person.prototype = new Person()
Person.prototype.constructor = Person
Person.prototype.sayName = function(){
console.log(this.name)
}
// 定义Teacher构造函数
function Teacher (name,level){
this.name = name
this.level = level
}
Teacher.prototype = new Person()
Teacher.prototype.constructor = Teacher
Teacher.prototype.sayLevel = function(){
console.log(this.level)
}
// 定义MathTeacher构造函数
function MathTeacher(name, level, className){
this.name = name
this.level = level
this.className = className
}
MathTeacher.prototype = new Teacher()
MathTeacher.prototype.constructor = MathTeacher
MathTeacher.prototype.sayClassName = function (){
console.log(this.className)
}
let liSi = new Person('Li Si')
let wangLaoShi = new Teacher('Wang Wu','Normal')
let zhangLaoShi = new MathTeacher('Zhang San','Great', 'Math')
console.log(liSi.hasOwnProperty("sayHello"))
console.log(wangLaoShi.hasOwnProperty("sayHello"))
console.log(zhangLaoShi.hasOwnProperty("sayHello"))
liSi.sayHello()
wangLaoShi.sayHello()
zhangLaoShi.sayHello()
liSi.sayName()
wangLaoShi.sayName()
zhangLaoShi.sayName()
wangLaoShi.sayLevel()
zhangLaoShi.sayLevel()
zhangLaoShi.sayClassName()
def count_up(n):
if n < 2:
print(n)
else:
count_up(n-1)
print(n)
count_up(5)
So you want to be a wizard - Julia Evans
本问题是上面这篇博文的笔记。
(define (sqrt x)
(define (improve guess)
(average guess (/ x guess)))
(define (average a b)
(/ (+ a b) 2))
(define (good-enough? guess)
(< (abs (- (square guess) x))
0.001))
(define (try guess)
(if (good-enough? guess)
guess
(try (improve guess))))
(define (square a)
(* a a))
(try 1))
判等与隐式转换
null == undefined => true
参考文档:You-Dont-Know-JS/ch4.md at 2nd-ed · getify/You-Dont-Know-JS
Asynchronous programming in Python has become more and more popular lately.
def bin_find_v1(v, lo, hi, e):
if lo >= hi:
return -1
else:
mi = (lo + hi) // 2
if v[mi] == e:
return mi
if v[mi] > e:
return bin_find_v1(v, lo, mi, e)
else:
return bin_find_v1(v, mi+1, hi, e)
v = [1, 2, 3, 4, 5, 6, 7]
bin_find_v1(v, 0, len(v), 3)
版本一:三个区间的二分查找,且头尾区间不均衡。
Python tutor 演示链接
能面试的程度
中级
我们用的插件里有用闭包的地方,如果我看源码,我能看出来为啥有闭包?就是为了能在别的地方调用b函数用到函数a里的变量
a包着b
不要刻意去记住某件事,而要去寻找使其显而易见的解释。 -- 理查德·费曼
changA 不传参
let a = {a: 3}
function changeA(){
a = {a: "change"}
}
changeA()
a = {'a': 3}
def changeA():
a = {'a': "change"}
changeA()
Python 版仿 JS dispatch 源码来自大桃,哈哈哈
C++
Java
JS
Python
...
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.