Xah Talk Show 2024-04-18 Ep545, ASMR Edition. Keyboard News and JavaScript Coding
- 30:21 start JavaScript coding
const f_create_keymap = (layout1, layout2) => {
const xresultMap = new Map([]);
[...layout1].forEach((item, index) => {
if (item === layout2[index]) {
} else {
xresultMap.set(item, layout2[index]);
}
});
return xresultMap;
};
const layout1 = `
qwertyuiop[]\\
asdfghjkl;'
zxcvbnm,./
`;
const layout2 = `
byou';ldwvz=\\
ciea,.htsnq
gxjk-/rmfp
`;
console.log(f_create_keymap(layout1, layout2));