Skip to content

异步、回调 #12

@yongheng2016

Description

@yongheng2016

异步和直接调用对应
而异步一般和回调的套路一块出现的(不然拿不到结果)

function fn(another){
    setTimeout(
    another(参数)
    ,10000)
}
fn()  直接调用

function  another(参数){
    console.log('参数')
}
fn(another) //异步,派一个函数过去,让别人执行这个函数(里面有一个回调的套路)

阮一峰(四种异步模式):
http://www.ruanyifeng.com/blog/2012/12/asynchronous%EF%BC%BFjavascript.html

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions