console
/**
* 问题1: 在 id 为 app 的元素内创建 10 个 <a> 标签, 点击弹出对应序号
* PS: 右侧白色区域即 #app, 无需创建
*/
function aLinkCreator () {
// ...
}
aLinkCreator()
/**
* 问题2: 编辑 .triangle 的样式, 画出一个三角形
* PS: .triangle 的 DIV 已建立, 仅需修改 CSS
*/
// 于上方切换到 CSS 标签
/**
* 问题3: 输入任意字符串, 去除字符串头尾空格
* 例: trim(' abc ef g ')
*/
function trim (inputString) {
// ...
}
console.log(trim(' abc ef g '))
/**
* 问题4: 数组去重
* 例: ([1, 2, '4', 5, 1, 2, 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()
* seq1.next()
*
* const seq2 = new Sequence()
* seq2.next()
* seq2.next()
*/
// ...
/**
* 问题7: 输入 N 个数组组成的二维数组, 输出所有数组的全部组合的二维数组.
* 例: getCombination([[1, 2], ['a', '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;
}
.triangle {
}