Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 -->
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
<!-- 声明文档使用的字符编码 -->
<meta charset='utf-8'>
<!-- 优先使用 IE 最新版本和 Chrome -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<!-- 页面描述 -->
<meta name="description" content="不超过150个字符"/>
<!-- 页面关键词 -->
<pre>
<script>
function levenshtein(a,b) {
var table = [[[]]];
for(var j = 1; j <= b.length; j++) {
table[0][j] = b.slice(0,j).map(function(e,j){return {action:"insert",element:e,position:j}});
}