educative.io

Educative

Solution doesn't seem to work for an edge case

var abcd = 2a example is supposed to return false, however the solution
/(var)\s([a-z]+)\s=\s([0-9]+)/g
considers this as true because the 2 is matched as a digit and doesn’t consider the a at the end which breaks one of the conditions in the question.