SOURCE

console 命令行工具 X clear

                    
>
console
/**
 * 问题1: 在 id 为 app 的元素内创建 10 个 <a> 标签, 点击弹出对应序号
 * PS: 右侧白色区域即 #app, 无需创建
 */

function aLinkCreator () {
  // ...
}
aLinkCreator()

/**
 * 问题2: 编辑 .triangle 的样式, 画出一个三角形
 * PS: .triangle 的 DIV 已建立, 仅需修改 CSS
 */

// 于上方切换到 CSS 标签

/**
 * 问题3: 输入任意字符串, 去除字符串头尾空格
 * 例: trim('   abc  ef g  ') --> 'abc  ef g'
 */

function trim (inputString) {
  // ...
}
console.log(trim('   abc  ef g  '))

/**
 * 问题4: 数组去重
 * 例: ([1, 2, '4', 5, 1, 2, 3, 4]) --> [1, 2, '4', 5, 3, 4]
 */

function arrayDeduplication (inputArray) {
  // ...
}
console.log(arrayDeduplication(([1, 2, '4', 5, 1, 2, 3, 4])))

/**
 * 问题5: 实现函数节流: 规定一个单位时间,在这个单位时间内,
 *  只能有一次触发事件的回调函数执行,如果在同一个单位时间
 *  内某事件被触发多次,只有一次能生效
 */

function throttle (fn, wait) {
  // ...
}

/**
 * 问题6: 实现工具类 Sequence
 * 工具使用方法:
 * const seq1 = new Sequence()
 * seq1.next() --> 1
 * seq1.next() --> 2
 * 
 * const seq2 = new Sequence()
 * seq2.next() --> 3
 * seq2.next() --> 4
 */

 // ...

/**
 * 问题7: 输入 N 个数组组成的二维数组, 输出所有数组的全部组合的二维数组.
 * 例: getCombination([[1, 2], ['a', 'b'], [true]])
 *      --> [[1, 'a', true],[1, 'b', true],[2, 'a',true],[2, 'b', true]]
 */

function getCombination (inputArray) {
  // ...
}
console.log(getCombination([[1, 2], ['a', 'b'], [true]]))
<!-- 无需修改此页 -->
<div id="app">#app 链接显示区域</div>

<div class="triangle"></div>
#app {
    background: #fff;
    padding: 10px 12px;
    border-radius: 4px;
}

/** 问题2编辑区域 */
.triangle {
}