2020-08-01 html building module + css penetration attribute + JS thousands of formatted numbers

2020-08-01 Title source: http://www.h-camel.com/index.html

[html] Regarding H5 as an open platform, what are the modules to build it?

1.web storage API

2. LBS based on location services

3. Play audio and video without plug-ins

4. Invoke hardware devices such as cameras and GPU image processing units

5. Drag and drop and Form API

[css] What are the penetration properties of css?

1.VUE style penetration https://blog.csdn.net/idomyway/article/details/94659598

2. Click to penetrate pointer-event: none; //Allow pointer-event: auto; //Prohibit

[js] Use js to write a method to format number thousands

1. Insert a comma every 3 digits

/ 方法一 字符串   
function toThousands(num) { 
    var result = '', counter = 0;   
    num = (num || 0).toString();    
    for (var i = num.length - 1; i >= 0; i--) {
            counter++;  
        result = num.charAt(i) + result;    
        if (!(counter % 3) && i != 0) { result = ',' + result; }    
    }   
    return result;  
}/


// 方法二 分组合并:先把数字的位数补全为3的倍数,然后join添加逗号,最后把补的多余的0删除   
function toThousands(num) { 
    var num = (num || 0).toString(), temp = num.length % 3; 
    switch (temp) {
        case 1: 
        num = '00' + num;   
        break;  
        case 2: 
        num = '0' + num;
        break;  
    }
    return num.match(/\d{3}/g).join(',').replace(/^0+/, '');    
}


// 方法三 正则表达式
function toThousands(num) {
    return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
}

[Soft skills] What is the difference between full-width characters and half-width characters?

1. Full-width: One character occupies 2 standard character positions. Chinese characters, graphic symbols, and special characters are all full-width, and are generally only used for word processing.

2. Half-width: One character occupies one standard character position. English letters, numbers, and symbol keys are all half-width. Half-width characters are ASCII characters.

Guess you like

Origin blog.csdn.net/vampire10086/article/details/108339806