Skip to main content
added 216 characters in body
Source Link
konijn
  • 34.4k
  • 5
  • 71
  • 267

My 2 cents:

  • Use jQuery toggleClass : http://api.jquery.com/toggleClass/
  • Use camelCase : currencycode -> currencyCode etc.
  • Use English everywhere : 'monnaie' should not be there
  • Booleans are awesome
        if($myCurrencycode == $initCurrencycode) {
            hasChanged = false;
            console.log(hasChanged);
        } else {
            hasChanged = true;
            console.log(hasChanged);
        }

should be

   hasChanged = ($myCurrencycode != $initCurrencycode)
   console.log( hasChanged );
  • Finally,
if(!$menuDropdown.hasClass('hide')) {
  $menuDropdown.addClass('hide');
}

can be replaced with $menuDropdown.addClass('hide'); it will not add the class multiple times.

My 2 cents:

  • Use jQuery toggleClass : http://api.jquery.com/toggleClass/
  • Use camelCase : currencycode -> currencyCode etc.
  • Use English everywhere : 'monnaie' should not be there
  • Booleans are awesome
        if($myCurrencycode == $initCurrencycode) {
            hasChanged = false;
            console.log(hasChanged);
        } else {
            hasChanged = true;
            console.log(hasChanged);
        }

should be

   hasChanged = ($myCurrencycode != $initCurrencycode)
   console.log( hasChanged );

My 2 cents:

  • Use jQuery toggleClass : http://api.jquery.com/toggleClass/
  • Use camelCase : currencycode -> currencyCode etc.
  • Use English everywhere : 'monnaie' should not be there
  • Booleans are awesome
        if($myCurrencycode == $initCurrencycode) {
            hasChanged = false;
            console.log(hasChanged);
        } else {
            hasChanged = true;
            console.log(hasChanged);
        }

should be

   hasChanged = ($myCurrencycode != $initCurrencycode)
   console.log( hasChanged );
  • Finally,
if(!$menuDropdown.hasClass('hide')) {
  $menuDropdown.addClass('hide');
}

can be replaced with $menuDropdown.addClass('hide'); it will not add the class multiple times.

Source Link
konijn
  • 34.4k
  • 5
  • 71
  • 267

My 2 cents:

  • Use jQuery toggleClass : http://api.jquery.com/toggleClass/
  • Use camelCase : currencycode -> currencyCode etc.
  • Use English everywhere : 'monnaie' should not be there
  • Booleans are awesome
        if($myCurrencycode == $initCurrencycode) {
            hasChanged = false;
            console.log(hasChanged);
        } else {
            hasChanged = true;
            console.log(hasChanged);
        }

should be

   hasChanged = ($myCurrencycode != $initCurrencycode)
   console.log( hasChanged );