4
Your app seems to be working :) Good job and keep going ! Take a look at the below notes. I will try to add more a bit later.
Treat Your variable name as instructions for other developers (and yourself from future). They should be descriptive. Function with name such as Function2 are not acceptable
Your HTML inputs do not have associated labels
You use h1 ...
2
Coding style
Format your code with correct indent. Format your HTML with correct closing tags.
Name your variable / function / DOM elements with some meaningful names. Not myFunction1 nor div0.
You declared myFunction as global one, but use const for myFunction2. I would suggest use same style for every functions.
HTML
If you are posting a snippet, skip &...
2
First I think that using document.querySelector seems much user friendly than using document.getElementsByClassName. Instead of let coll = document.getElementsByClassName('collection'); coll[0].xxx, we can just use document.querySeletor('collection').xxx.
So code can refactor a bit to
let coll = document.querySelector('.collection');
let dis = ...
2
Poor naming
The first thing that popped out at me was the naming. Starting with BMI
(BMI) Body mass index is not a time dependent quantity. You show a calculated value under the heading <h1 class="title">Your daily BMI is:</h1> which makes no sense at all.
I don't know what the value you are calculating is. I will assume that the string ...
1
The \x{0020} (SPACE) character is already included in \s, you can omit that part.
I prefer to use \p{Cc} over [:cntrl:] for consistency and because I don't like to have nested square braces in a character class.
I expect isAttributeNameValid() to be checking that the whole string contains NO blacklisted characters. If you want to match the entire string ...
1
There are some things that You could improve:
Why do You treat a span element as a button when there is a more semantic solution which is a button element
Another bad practice is an inline styling. It gives too much specificity to the element and it's hard to maintain that. Use stylesheets instead.
Your variable names should be more descriptive. You want to ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
html × 1687javascript × 969
css × 608
jquery × 445
php × 225
beginner × 180
html5 × 124
dom × 106
performance × 77
form × 75
python × 61
angular.js × 45
twitter-bootstrap × 44
c# × 42
animation × 41
parsing × 39
event-handling × 39
ajax × 35
mysql × 33
ecmascript-6 × 33
object-oriented × 29
regex × 26
json × 26
calculator × 25
sass × 25