DEV Community

Discussion on: Hands-on Vue.js for Beginners (Part 7)

Collapse
 
rodz profile image
Rodrigo Gomez

I get an exception the very first time this code runs since oldValue is null.

This is what I did to get it to not throw the exception:

if ((!oldValue || oldValue.toLowerCase().indexOf("metroid")!==-1) &&
newValue.toLowerCase().indexOf("metroid") ===-1
) {
this.response = "GET TO DA CHOPPA NAO";
return;
}