手写ajax
var xmlhttp if(window.XMLHttpRequest){ xmlhttp= new XMLHttpRequest() }else{ xmlhttp =new ActiveXObject('Microsoft XMLHTTP') } xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ console.log(xmlhttp.responceText) } } xmlhttp.open('get','/',true) xmlhttp.send()
手写迭代器
function iteartor(arr){ const index = 0 return { next:function(){ return index<arr.length?{ value:arr[index++] , done:false}:{ value:undefined , done: true} } } }