SOURCE

console 命令行工具 X clear

                    
>
console
window.jQuery = function (nodeSelector){
  let nodes = {}
  if(typeof nodeSelector === "string"){
    let temp = document.querySelectorAll(nodeSelector);  //伪数组
    for(let i=0; i<temp.length; i++){
      nodes[i] = temp[i]
    }
    nodes.length = temp.length
  }else if(nodeSelector instanceof Node){
    nodes = {
    	0:nodeSelector,
    	length:1
  	}
  }

  nodes.addClass = function(classes){
      for(let i =0; i<nodes.length; i++){
        nodes[i].classList.add(classes)
      }
  }
  nodes.text = function(text){
    if(text === undefined){
      var texts = [];
      for(let i =0;i<nodes.length;i++){
        texts.push(nodes[i].textContent)
      }
      return texts
    }else{
      for(let i =0; i< nodes.length;i++){
        nodes[i].textContent = text;
      }
    }
  }
  return nodes;
}
window.$ = jQuery;
$("ul>li").addClass("blue")
$("ul>li").text("444")
<ul>
  <li>项目1</li>
  <li>项目2</li>
  <li>项目3</li>
  <li>项目4</li>
  <li>项目5</li>
  <li>项目6</li>
</ul>
.blue{
  color:blue;
}