function test() {
const dp = []
dp[0] = 1, dp[1] = 1, dp[2] = 2
return function step(n) {
if (typeof (dp[n]) === 'number') return dp[n]
for (let i = 3; i < n; i++) {
dp[i] = dp[i - 1] + dp[i - 2]
}
return dp[n - 1]
}
}
console.log(test()(5))
function verifyPhone(number) {
const reg = /^1[2-9]\d{9}$/
return reg.test(number)
}
function verifyEmail(email) {
const reg = /^[a-zA-Z0-9._-]/
}
// function formatDate(date,format) {
// var day = date.getDate()
// var month = date.getMonth()+1
// var year = date.getFullYear()
// format = format.replace(/yyyy/,year)
// }
function markdownToHTML(markdown) {
// 使用正则表达式进行替换
const html = markdown.replace(/###(\w+)/g, '<h3>$1</h3>')
.replace(/##(\w+)/g, '<h2>$1</h2>')
.replace(/#(\w+)/g, '<h1>$1</h1>')
return html;
}
const markdownText = "###g##g#g";
const htmlResult = markdownToHTML(markdownText);
console.log(htmlResult);
console.log(verifyPhone())
console