每天积累一丢丢(Tue, 3 May 2016)

之前一直KiCad画画电路板,Matalb模拟个小图图,习惯一直是把东西随手写在小本子上。现在来看似乎各大公司招聘的时候都希望应聘者可以有自己的博客作为积淀体现。 恰好, 现在到了新的阶段,也该做一个好好的总结了,可以把之前记下来的内容写到博客上,保存也更加安全 (I hope so)。这些内容没有什么前后逻辑,因为小本子上有些内容实在是太基础啦... 挑些重要的概念和tricky方法记录下.


Javascript is a objects-based language, I was a little bit confused about this so-called 'object-based language' here, why was that?

http://stackoverflow.com/questions/6954293/difference-between-object-oriented-and-object-based-language  <--- this article explained clearly.

But I think I can give a more intuitively explanation here: based on 

https://developer.mozilla.org/en/docs/Web/API/NodeList

it says 'JavaScript has an inheritance mechanism based on prototypes for both built–in objects (like Arrays) and host objects (like NodeLists)', and check this, 

typeof Array.prototype #Object

Now I can understand why Js is a OBL la! 


How Can I perform Array's method ex. slice(), pop() upon a ChildNode since it is NOT a array?

Call and Apply! Array.prototype.call(arguments) and I can even Array.prototype.call(arguments).forEach('arg', ()=>{}); Cannot be cooler and more elegant(Manson likes to use this phrase, 'elegant' codes XD) from my point of view.


What are the differences between .call and .apply?

To give a simplest sentence here: 

.call(execution context, arg1, arg2, arg3 ...) 

while .apply use array as an argument like follows:

.apply(execution context, [arg1, arg2, arg3 ,arg4 ]

But what more of ???? UNDER CONSTRUCTION HERE 


Things need to know about Variables.

JS是弱类型语言,弱到什么地步呢,弱到可以声明var的时候声明出一个什么类型都行那么弱,然后我还可以把这个类型再改写(不推荐这么搞,另外书上提到了‘每个变量仅仅是一个用于保存的占位符而已’)。

JS中数据类型可以是76种那么多,

3种主要数据类型:string, boolean, number

2种复合型数据类型:function,object   ----->>> 这里需要做出更正, 书上写说只有六中数据类型,刚刚查到说function                                      应该被认为是Function object, 不然Array怎么算.

以及特殊数据类型:null and undefined ----> buttypeof null #'object'

按照书上的分类是:

简单数据类型(或基本数据类型):Undefined, Null, Boolean, Number, String

复杂数据类型:Object

另外用var来定义的局部变量,比如在一个function中定义,那么在函数return之后这个变量就会被销毁了

之所以把variables删掉是因为看起来我的对基础概念实在是混淆到一定程度了。

另一种xx类型叫做引用类型,解释为:‘引用类型是一种数据结构,用于将数据和功能组织在一起,有时候也称为对象定义,因为它们描述的是一类对象所具有的属性和方法, 而对象其实就是指某个特定引用类型的实例’










       


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值