6 Replies
my html code:
my code JS:
I don't have any error but nothing appear can I hav some idea about what is going wrong ?
thanks by advance
This doesn't do anything, other than define a bunch of variables
you're redeclaring valeur-valeur4 in the scope of the function, and that scope is discarded
you also have a bunch of other errors in the rest of the code.
You're appending all the spans to outer
In the resize function, you're probably looking for
window.screen
and not just screen
You're setting valuer.innerHTML
to "" four times. You don't need to clear the inner html of a freshly created element, it's pointless
Also, indentation and spacing may not matter for javascript, but it's vital to keep it consistent so that you can actually read your code. I'd really recommend either having something like prettier format your code, or else just get disciplined at fixing it manually. If someone submitted code to me as part of an application and it's messily indented, that entire application probably goes straight in the trash. It causes bugs and wastes time debugging and mentally parsing unreadable code.
(also, as a final thing, codepens or similar really help people help you. I copy/pasted your code to one of my own because it helps a lot to see the code run and see what it does and doesn't do exactly, and then be able to edit it. A lot of people (me included when I'm tired) may or may not go to that effort and just skip your question. It took about 20 seconds, but it's work you ask the asker could do for the person trying to solve your problem, which makes it much more likely they'll help)Hi thanks for your message
that s what I do before
but he don't work
that's because you're using let, that redeclares the variables in the current scope
remove
let
now I have this
![No description](https://cdn.answeroverflow.com/1195820713462996992/aaaaaaaaaaaaaaaaa.jpg)
yes, because of the other issues I pointed out. You're appending everything to
outer
, and the screen details are in window.screen
, not screen