
获得徽章 0
赞了这篇文章
赞了这篇文章
小知识:substr和slice和substring
substr 已废弃!
slice(startindex, endindex) -- 不包含 endindex -- 负数从尾部开始计算
substring(startindex, endindex) -- 不包含endindex -- 负数全部转为0
substr 已废弃!
slice(startindex, endindex) -- 不包含 endindex -- 负数从尾部开始计算
substring(startindex, endindex) -- 不包含endindex -- 负数全部转为0
5
9
🧄每周一道算法题
function missingLetters(arr){
if(arr.length <=1 ){
return []
}
let res = []
for(let i=0; i<arr.length-1; i++){
let next = arr[i+1].charCodeAt()
let now = arr[i].charCodeAt()
while(next - now > 1){
res.push(String.fromCharCode(++now))
}
}
return res
}
let result1 = missingLetters(['a', 'b', 'c', 'd', 'f'])
let result2 = missingLetters(['a', 'b', 'd', 'e','h','i','j','k','z'])
console.log(result1)
console.log(result2)
function missingLetters(arr){
if(arr.length <=1 ){
return []
}
let res = []
for(let i=0; i<arr.length-1; i++){
let next = arr[i+1].charCodeAt()
let now = arr[i].charCodeAt()
while(next - now > 1){
res.push(String.fromCharCode(++now))
}
}
return res
}
let result1 = missingLetters(['a', 'b', 'c', 'd', 'f'])
let result2 = missingLetters(['a', 'b', 'd', 'e','h','i','j','k','z'])
console.log(result1)
console.log(result2)
展开

1
3
1、storeToRefs()作用:从store提取属性时保持其响应式
(store的状态发生变化时,引用也会更新)
2、store 是reactive包裹的对象,不可以解构
(通过1 方法解构 const {name, age} = storeToRefs(store))
(store的状态发生变化时,引用也会更新)
2、store 是reactive包裹的对象,不可以解构
(通过1 方法解构 const {name, age} = storeToRefs(store))
1
点赞
今日
1、算法题
leetcode.cn
2、题-闭包实现
为进烟草工作有人愿出45万却遭骗; 河北500多人被洪水围困?当地回应11林志玲回应家暴传闻
1. 把里面的数字替换成 *
1.1 ex: 45 -> *; 500 -> *
1.2 ex: 45 -> **; 500 -> ***
2. 轮询替换 '*#'.
2.1 ex: 45 -> *; 500 -> #; 11 -> *
2.2 ex: 45 -> *#; 500 -> *#*; 11 -> #*
知识点:
replace(),第一个参数:要替换字符/正则,第二个参数:替换数据/函数
hasOwnProperty(),只在实例上的属性,原型上不算
栈存取数据概念
轮询取数组元素用% arr=[1,2,3,4] index%arr.length Nice!!
1、算法题
2、题-闭包实现
为进烟草工作有人愿出45万却遭骗; 河北500多人被洪水围困?当地回应11林志玲回应家暴传闻
1. 把里面的数字替换成 *
1.1 ex: 45 -> *; 500 -> *
1.2 ex: 45 -> **; 500 -> ***
2. 轮询替换 '*#'.
2.1 ex: 45 -> *; 500 -> #; 11 -> *
2.2 ex: 45 -> *#; 500 -> *#*; 11 -> #*
知识点:
replace(),第一个参数:要替换字符/正则,第二个参数:替换数据/函数
hasOwnProperty(),只在实例上的属性,原型上不算
栈存取数据概念
轮询取数组元素用% arr=[1,2,3,4] index%arr.length Nice!!
展开
4
4
赞了这篇文章