var myLove =0;
var myLife = 'you';

if(yourHeart =='Me'){
myLove =+1;
else {
myLife = null;
myLove = undefined;

  • 3
    I'd say,
  • 4
    Unfortunatly, this love story ends up too quickly. A missing bracket and an undefined heart :/
  • 1
    I'm sorry but I can't resist...If you have to reassign variables, try to reassign them to the same type. Like 'myLife' to an empty string and myLove to a number. Also, use strict equality to avoid headaches and weird runtime errors. It might even make more sense to make myLove a boolean here.
  • 1
    @Robbatron Typescript can help in that case :)
  • 1
    @tomabolt I use TypeScript a lot but I definitely don't think it's necessary for writing good JS.
  • 1
    @Robbatron yes it's sometimes more confusing than helping when you don't understand javascript well...
Your Job Suck?
Get a Better Job
Add Comment