extract string from text file javascript

JavaScript
$(function () {
    $.get('/your_file.txt', function (data) {
       words = data.split('\s');
    });
});
Source

Also in JavaScript: