function columation(n){
if(n <= 1){
return 1
}else{
return n + columation(n - 1)
}
}
// console.log(columation(3))
function factorial(n){
if(n <= 1){
return 1
}else{
return n * factorial(n-1)
}
}
// console.log(factorial(5))
function Fibonacci(n){
if(n < 1){
return 0
}else if(n === 1 || n=== 2){
return 1
}else{
return Fibonacci(n - 1) + Fibonacci(n-2)
}
}
// console.log(Fibonacci(7))
let old = [
{
r: 0,
c: 0,
val: '呵呵'
},
{
r: 1,
c: 0,
val: '嘻嘻'
},
{
r: 2,
c: 0,
val: '哈哈'
},
{
r: 3,
c: 0,
val: 'kk'
},
]
let newData = {
}
old.forEach((v, index) => {
if(v){
let key = 'val' + 'index'
let value = v.val
newData[key] = value
}
console.log(newData)
})
console