Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for First Word (simplified) by hkgok1
import assert from "assert";
function firstWord(text: string): string {
// your code here
var first_word = text.split(" ",1)
return first_word[0] ;
}
console.log('Example:');
console.log(firstWord('Hello world'));
// These "asserts" are used for self-checking
assert.equal(firstWord('Hello world'), 'Hello');
assert.equal(firstWord('a word'), 'a');
assert.equal(firstWord('hi'), 'hi');
console.log("Coding complete? Click 'Check' to earn cool rewards!");
June 5, 2021
Comments: