reduce函数,reduce函数python

首页 > 教育 > 作者:YD1662024-04-07 21:10:51

console.log样式函数【重写console.log】

function randomColor() { let r = Math.floor(Math.random()*256); let g = Math.floor(Math.random()*256); let b = Math.floor(Math.random()*256); //返回随机生成的颜色 return "rgb(" r "," g "," b ")"; } console.log = (function(oriLogFunc){ return function(...data) { const icons = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "⚽", "", "", "", "⭕", "❌", "❓", "❗", ""] const icon = icons[Math.floor(Math.random() * icons.length)]; const bgColor = randomColor() const color = randomColor() oriLogFunc.call(console,`%c ${icon} `, `border-radius:5px;padding:12px;border:1px solid #000;color: #43bb88;font-size: 16px;font-weight: bold;text-decoration: underline;`, ...data); } })(console.log);

reduce函数,reduce函数python(21)

参考资料
  1. https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
  2. https://www.jianshu.com/p/a2f2a7eeb662
上一页23456末页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.