0%

实现字符串翻转方法

1
2
3
4
5
6
function reverseString(str) {
var litters=str.split("");
var rlitters=litters.reverse();
return rlitters.join("");
}
reverseString("hello");

区分String方法split以及Array方法slice, splice

split 以特定字符或正则表达式为标记,将字符串分割为字符串数组
slice 以起止下标为界切片返回新数组,原数组不受影响
splice 以起止下标为界切片从数组中剔除

常用到的将含length的对象转为数组用

1
Array.prototype.slice.call(a)

实现数字千位分隔符

1
2
3
4
5
6
7
8
9
10
11
function kiloFormat(num){
num=num.toString().split(".");//区分整数部分和小数部分
num[0]=num[0].split("").reverse();//整数部分数组化并翻转
num[0]=num[0].map((item,i)=>{
if(i%3==0&&i!=0){
return item+=",";
}else{return item;}
});
num[0]=num[0].reverse().join("");
return num.join(".");
}

1
2
3
4
5
6
7
8
// 另 正则表达式实现
function thousandBitSeparator(num) {
return num && num
.toString()
.replace(/(\d)(?=(\d{3})+\.)/g, function($0, $1) {
return $1 + ",";
});
}

标题

1

1.1

1.1.1

1.1.1

1.1.1 a
1
2
3
var a="1";
a+=2;
print a;

这一段,

引言


叫区块引用

斜体
加粗
删除线
下划线

  • 第一教条
  • 第二条
  1. 首先
  2. 然后
  3. 最后
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    viverra nec, fringilla in, laoreet vitae, risus.
  • Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    Suspendisse id sem consectetuer libero luctus adipiscing.

这个是百度链接 可以使用相对路径

QQstone笔记

根据某某某考证,见[该刊]1

站内超链接:关于websockt 详见 WebSocket篇

1
{% post_link 文章文件名 显示文字 %}

反引号``取消自动超链接: https://www.baidu.com 但是有个高亮背景,或者用\

cannot load pic here
cannot load pic here

左对齐 居中 右对齐
内容 内容 内容
内容 内容 内容

console.log('code here')

1
console.log('code here')

矩阵

更多数学表示—> CSDN: nuoyanli
公式的语法是mathjax的规范 hexo-js-next渲染公式需用hexo-renderer-kramed(默认是hexo-renderer-marked)
配置theme\next_config.yml mathjax: enable: true
同时在文章title下使能 mathjax: true
详见hexo-theme-next doc:数学公式

PlantUML绘图

安装VS Code插件: Markdown Preview Enhanced, PlantUML

1
2
3
4
5
6
7
8
9
10
11
12
13

== Initialization ==

Alice -> Bob: : Can you solve: <math>ax^2+bx+c=0</math>
Bob --> Alice: <math>x = (-b+-sqrt(b^2-4ac))/(2a)</math>
activate Alice #FFBBBB
note left: this is a first note

Alice -> Bob: Another dialogue
deactivate Alice

Alice <-- Bob: Another dialogue