Silly-Say/SillySay.js

19 lines
507 B
JavaScript

"use strict";
// Import the word splitter from WordSplitter.js
// Note that you don't need to specify the extension - browserify can determine this automatically.
import splitWords from './WordSplitter';
function sillySay(sentence) {
// Split the sentence up into words
var words = splitWords(sentence);
// Loop over all the words in the above array and display them one by one
for(let i in words) {
alert(words[i]);
}
}
// Make sillySay accessible from the outside.
window.sillySay = sillySay;