I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
I applaud you for wanting to move away from frameworks you have come to rely on - it will definitely help you in the long run when it comes to debugging in the future!
Here are a few things I noticed, and that could be improved with your calculator.
##HTML
- Try to stay away from inline styles. Adding
style
attributes for single elements might seem like an easy way to quickly apply a style, but it makes your HTML messy and CSS hard to debug. Inline styles will override CSS, which eventually leads to using!important
. You also don't give the browser the chance to cache that style, as it will for CSS documents which rarely change. - Try to avoid using
onclick
attributes to hook up Javascript events to elements. This also falls under the category of Don't Repeat Yourself (DRY), since a lot of the events call thecode
function. It's possible to handle this with one event and one event listener that looks at theinnerText
of the caller! - Courtesy of Ismael in the comments: You're missing a doctype! Fortunately, the HTML5 doctype is super easy. Just add
<!doctype html>
before your<html>
tag. - You need to add a
<title>
tag to your head section, which gives the page the name that appears in the taskbar and tab of a user's web browser. - See if you can save your CSS in an external stylesheet (file.css for example) and reference it in the head section like so:
<link rel="stylesheet" href="file.css">
##Javascript
- There's a loooot of ternary action happening in the
code
function to the point of making it unreadable. I'm not quite sure what this function even does at first glance - I have to format it extensively to begin to see how it works. It looks like it eventually creates a function from a string, which I think is a pretty clever way to solve the classic calculator problem in JS. - To implement the change I mentioned above about
onclick
andcode
, see @cimmanon's answer, which is much better than what I had here previously.
If you apply a specific class to all buttons that call code
, you can get rid of that nasty switch
completely.
rezPlz
is an interesting variable name ;)
And some nitpicky things:
- It's good practice to put semicolons after settings variables and expressions -
var code = function() { ... };
is an example of this. However, you don't need a semicolon after explicit function declarations, such asfunction restring(str) { ... };
. Source - Because of your use of
onclick
, the code won't run if the script is found outside the body. In this case, it's between</body>
and</html>
, which is pretty weird. Including scripts this way (I believe) also forces the browser to wait until the script is done loading before it displays anything to the user! - I'm not sure if it's because you wanted to include all your code in one code block for this question, but having CSS at the end of the document - especially in
<style>
tags - is just bizarre. This causes a FOUC! Source
Hopefully this helps!
- 285
- 1
- 7