Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Goes Right After by Dmitry_Sternyaev
import { equal } from "assert";
/**
* @param {String} word
* @param {String} first
* @param {String} second
*/
function goesAfter(word, first, second) {
// your code here
return word.search(`^[^${first}${second}]*${first}${second}`) > -1;
}
console.log("Example:");
console.log(goesAfter("world", "w", "o"));
// These "asserts" are used for self-checking
equal(goesAfter("world", "w", "o"), true);
equal(goesAfter("world", "w", "r"), false);
equal(goesAfter("world", "l", "o"), false);
equal(goesAfter("panorama", "a", "n"), true);
equal(goesAfter("list", "l", "o"), false);
equal(goesAfter("", "l", "o"), false);
equal(goesAfter("list", "l", "l"), false);
equal(goesAfter("world", "d", "w"), false);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
May 17, 2020
Comments: