// using string methods only filename.substring(0, filename.lastIndexOf('.')) || filename // using both string & array methods filename.split('.').slice(0, -1).join('.')
let file = "yourFileName.txt"; let filename = file.split('.')[0]