Skip to content

Comments

finish t1#1

Open
ChongChongS wants to merge 15 commits intoSimplyY:masterfrom
ChongChongS:master
Open

finish t1#1
ChongChongS wants to merge 15 commits intoSimplyY:masterfrom
ChongChongS:master

Conversation

@ChongChongS
Copy link

No description provided.

@SimplyY
Copy link
Owner

SimplyY commented Apr 2, 2016

commit = = 不忍直视。。要可读一点

加油把后面的题完成

-call()和apply()都是为了改变函数体内部this的指向
-func.call(this, arg1, arg2);
-func.apply(this, [arg1, arg2]);
-当参数是明确知道数量时,用 call,而不确定的时候,用 apply,然后把参数 push 进数组传递进去。
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

错啦,不是明确知道数量,而是当参数是数组的时候,用 apply

*/
function overTurn(s){
function sortStr(s){
var result = "";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

然而,,你函数内部的实现还是错的呀。。。是对 str 进行排序

@SimplyY
Copy link
Owner

SimplyY commented Apr 3, 2016

代码改好后,在 PR 一下,comment 一下,我审核通过了,就可以 merge 了。,

以及改正代码的时候要思考一下,为什么这么写,比如那个每隔一秒打印数组中的值,为什么闭包会造成打印的值一样,而使用函数参数(复制了值),可以使得值不一样

<component name="JavaScriptLibraryMappings">
<includedPredefinedLibrary name="ECMAScript 6" />
</component>
</project> No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants