文字列の末尾を削除する方法 CSVを作る際の最後尾のカンマを削除したいと思って検索 From https://syncer.jp/javascript-reverse-reference/how-to-use-substr
// 対象となる文字列 var text = "あいうえお" ; // 文字列の末尾1文字を削除する var result = text.substr( 0, text.length-1 ) ;