const menuType = [0, 1, 2, 4, 8, 16, 32 ,64, 128, 256, 512, 1024]
const type1 = [0, 1, 2, 4]
const type2 = [0, 1, 2, 5, 8,]
function sortMenuType (menuType) {
// 整理type值
if (menuType.length > 0) {
for (let i = 0; i < menuType.length; i += 2) {
type += menuType[i] | menuType[i + 1]
}
} else {
type = null
}
}
function anaMenuType (value) {
// 解析type值
let arr = []
for (var i = 0; i < 32; i++) {
var curValue = Math.pow(2, i)
console.log(value & curValue, arr.length)
if ((value & curValue) === curValue) {
arr[arr.length] = curValue.toString()
}
}
return arr
}
// console.log(anaMenuType(3))
// console.log(anaMenuType(6))
console.log(anaMenuType(7))