Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 10 months ago

Data Structures in JS: Map. Custom html inputs (text and radio)

Iván Fernández López•230
@IvanFdez01
A solution to the Mortgage repayment calculator challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What challenges did you encounter, and how did you overcome them?
  • I had problems customizing the radio-inputs (only with the check circle).

  • Then, the selection of the best DS for the script was tricky, but I think the best in this case is mapping the three main inputs. This means a map like:

  i:{
    'input': DOM' input type-text
    'icon': DOM' icon of the input (pound, percentage...)
    'err': DOM' error message (This field is required)
     },
  i+1: 
    {
    same for the next input element
    }
 } 

So with just being careful with the i you could deal more comfortably with the inputs to make them interactable around errors and user' attempts, achieving active states.

  • Finally, the web isn't responsive yet, I focused on JS :)
Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Chamu•13,820
    @ChamuMutezva
    Posted 10 months ago

    Hi.

    Having gone through your project, here is my observation:

    1. there is 3 css files that you are linking in the html file, which can affect perfomance . Among other thinks it increases the load time due to the number of http request that are required to load all the CSS and secondly CSS files are render blocking such that when the browser encounters the <link> tag for a CSS file it pauses rendering the page until the CSS is fully processed.
    2. It is very important to use semantic elements in your site , for example <p id = "clearall" class="clearall header">Clear all</p> . Since this element is supposed to clear all the fields - it is an interactive element and should therefore be a button element.
    3. All images should have the alt attribute , where when the image is decorative, the alt should be written as alt="" and in all other instances should carry a message that is in the image . The alt value should avoid words such as image, picture, icon etc as those are picked up by assistive technology automatically
    4. I see you have nested interactive elements as shown in the code below - in short interactive elements should not be nested
    <button id = "interestonly-button" class = "type-button input">
                  <input type = "radio" id = "interestonly-check" class="type-input">
                  <p class = "interestonly">Interest Only</p>
     </button>
    
    1. A CSS reset styles should be used , so as to keep your site look the same in almost all browsers
    2. The site is not responsive - I cannot view it on my mobile phone

    Conclusion

    The project is missing some basic fundamentals which you can improve through the Frontend Mentor Learning path. Ask for help in the discord channel as well to speed up the learnig process and check other solutions upon completing yours

    Marked as helpful
  • Joshua Abu•60
    @sirjaey
    Posted 10 months ago

    Great job! I see you have made significant changes as your site is now fully responsive across all screen sizes. Kudos fellow

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub