String.fromCharCode(9) // 製表符,用於分列 String.fromCharCode(10) // 換行符,用於換行
對應的代碼就是:
[1,String.fromCharCode(9),2,String.fromCharCode(9),3,String.fromCharCode(10),4,String.fromCharCode(9),5,String.fromCharCode(9),6].join('')
效果還不錯,滿足我們的需求,也足夠靈活,看起來沒有什麼坑,進一步封裝一下,實現一個二維數組數據 to EXCEL數據的方法就完成了。