DEV Community

loading...

Discussion on: snake_case, camelCase, or dash-case?

Collapse
taufik_nurrohman profile image
Taufik Nurrohman

IMO, it depends.

  1. If I want to make a file name, I will try to follow the URL naming convention, which will be kebab-case in common.
  2. If I want to make a function name in JavaScript, I will try to follow the JavaScript naming convention, which will be camelCase in common.
  3. If I want to make a function name in PHP, I will try to follow the PHP static function naming convention, which will be snake_case in common.
  4. If I want to make an ID or class name in CSS, I will try to follow the CSS naming convention, which will be kebab-case in common. It also match to the HTML naming convention.