SOURCE

console 命令行工具 X clear

                    
>
console
function add(num1, num2) {
    let sum = num1 + num2;
    if(num2 + 1 > 100) {
        return sum
    } else {
        return add(sum, num2+1)
    }
    
}
let sum = add(1, 2);
console.log('1+2=', sum)

//实现字符串反转
let str = 'abc'
console.log(str.split('').reverse().join(''))

String.prototype.reverse = function() {
    let re = this.split('')
    return re.reverse().join('')
}
let ss = 'ats'
console.log(ss.reverse())
<span class='text'>
    行内元素,水平垂直居中
</span>

<div class='box'>
    <div class='inner'>盒子</div>
</div>
.text {
    border: 1px solid red;
    width: 200px;
    height: 50px;
    line-height: 50px;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.box{
 border: 1px solid red;
 width: 100px;
 height: 100px;
 position: relative;
}
.inner {
    background: pink;
    width: 50px;
    height: 50px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%)
}