1 Star 0 Fork 0

martian2049/node

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tricks.js 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
martian2049 提交于 2018-06-02 23:26 . more learning
console.error('hi there');
console.warn('yooo');
console.info("wwwwww")
console.table(['Javascript', 'PHP', 'Perl', 'C++']);
// console.assert(false,'This will display');
// const superbitch = {
// firstname: 'Peter',
// lastname: 'Parker',
// obj:{
// a:"abc"
// }
// }
// console.table([superbitch]);
console.group();
console.log('I will output');
console.group();
console.log('more indents')
console.groupEnd();
console.log('ohh look a bear');
console.groupEnd();
console.time('id for timer');
console.timeEnd('id for timer');
// console.trace('dd')
const inventory = [
{name: 'apples', quantity: 2},
{name: 'bananas', quantity: 0},
{name: 'cherries', quantity: 5}
];
const result = inventory.find( fruit => fruit.name === 'cherries' );
console.log(result) // { name: 'cherries', quantity: 5 }
const inventory = [
{name: 'apples', quantity: 2},
{name: 'bananas', quantity: 0},
{name: 'cherries', quantity: 5}
];
const result = inventory.find( fruit => fruit.name === 'cherries' );
inventory.some
inventory.sort
inventory.unshift
console.log(result) // { name: 'cherries', quantity: 5 }
// Object literal
Object.entries({ 'a': 'A', 'b': 'B' }); // [["a","A"],["b","B"]]
// String
Object.entries('david') // [["0","d"],["1","a"],["2","v"],["3","i"],["4","d"]]
// Object literal
Object.values({ 'a': 23, 'b': 19 }) // [23, 19]
// Array-like object (order not preserved)
Object.values({ 80: 'eighty', 0: 1, 1: 'yes' }) // [1, 'yes', 'eighty']
// String
Object.values('davidwalsh') // ["d", "a", "v", "i", "d", "w", "a", "l", "s", "h"]
// Array
Object.values([1, 2, 3]) // [1, 2, 3]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/martian2049/node.git
git@gitee.com:martian2049/node.git
martian2049
node
node
master

搜索帮助