Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8570475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:34:00+00:00 2026-06-11T18:34:00+00:00

Recently I asked a question regarding my triangle calculations Coded in JavaScript. Basically I

  • 0

Recently I asked a question regarding my triangle calculations Coded in JavaScript. Basically I went to JSLint (A JavaScript debug facility) to acquire some data as to why nothing inside the function and procedure is working where as it all looks good and I followed previously given advice, but I believe this is a separate issue. I have posted the code below:

    <html>
<head>
<link href="stylesheet/stylesheet.css" rel="stylesheet" type="text/css">

<script language="Javascript" type="text/javascript">

/*  Key/Legend
Var
    inp1 = input1
    inp2 = input2
    inp3 = input3
    Triangle_Inputs = Form Name

    */

/* Notes

    In computing, a parser is one of the components in an interpreter or 
    compiler that checks for correct syntax and builds a data structure 
    (often some kind of parse tree, abstract syntax tree or other hierarchical structure) 
    implicit in the input tokens.


    Technique
    if (side1 is equal to side2 AND side 2 is equal to side3) {equalitateral}

    if (side1 is equal to side2 AND side 2 doesn't equal to side3) {isosceles}

    if (side1 doesn't equal to side2 AND side2 doesn't equal to side 3 AND side 3 doesn't equal side 1) {scalene}

    http://www.w3schools.com/js/js_comparisons.asp

    */


function checkinputs(){
/* Var = parseInt(document.Name_Of_Element_Form.Field_Name(Input).value); */
/* Input Fields */
inp1 = parseInt(document.Triangle_Inputs.input1.value);
inp2 = parseInt(document.Triangle_Inputs.input2.value);
inp3 = parseInt(document.Triangle_Inputs.input3.value);
/* Side options */
sideA = (inp1);
sideB = (inp2);
sideC = (inp3);
    if (sideA == sideB && sideB == sideC) {
    alert("Equalateral");
    }
    if (sideA == sideB && != sideC) {
    alert("Isosceles");
    }
    if (sideA != sideB == sideC) {
    alert("Isosceles");
    }
    if (sideA != sideB != sideC != sideA) {
    alert("Scalene!");
    }
}
</script>


</head>
<body>
<div id="Container">

<div id="Header"><h1></h1></div>

        <div id="Content_1">
                <div id="Explanation">
                This calculator will determine what
                triangle you have made depending on
                the integer values in the input fields.

                </div>
                <div id="Form">
                    <FORM NAME="Triangle_Inputs" METHOD="GET">
                    Enter the triangle values below: <br>
                    <p>
                    <h4>Side 1: </h4><BR>
                    <INPUT TYPE="Integer" NAME="input1" VALUE=""><P>
                    <h4>Side 2: </h4><BR>
                    <INPUT TYPE="Integer" NAME="input2" VALUE=""><P>
                    <h4>Side 3:</h4> <BR>
                    <INPUT TYPE="Integer" NAME="input3"  VALUE=""><P>
                    <INPUT TYPE="button" NAME="Submit" Value="Submit" Class="Submit" onClick="checkinputs()">
                    </FORM>
                </div>
                <div id="Verbal_Output">
                    <h2>You made a:</h2>
                    <p>        
                    <h2>Triangle</h2>
                </div>

            </div>
            <p>
            <p>
        <div id="Content_2">

        <div id="Image_Output">asdad</div>
    </div>      
</div>



</body>
</html>

This is the site itself, Ignoring the div tags. I want to know why I can’t click the button and more the the point why JSlint says:

inp1 = parseInt(document.Triangle_Inputs.input1.value);

line 39 character 1 ‘inp1’ was used before it was defined.

for the inp1,inp2 and inp3.

edit:

My understanding of using Variables was incorrect, I was listing them without using “,”s.
Instead I was calling one variable and the rest I wasn’t.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:34:01+00:00Added an answer on June 11, 2026 at 6:34 pm

    Try this:

    var checkinputs = function() {
    /* Input Fields */
    var sideA = parseInt(document.Triangle_Inputs.input1.value),
        sideB = parseInt(document.Triangle_Inputs.input2.value),
        sideC = parseInt(document.Triangle_Inputs.input3.value);
    
    alert (sideA == sideB && sideB == sideC) ? 'Equilateral' :
          (sideA == sideB && sideA != sideC) ? 'Isosceles' :
          (sideA != sideB && sideA == sideC) ? 'Isosceles' :
          (sideA != sideB && sideA != sideC && sideB != sideC) ? 'Scalene' :
          'logic needs improvement';
    }
    

    I noticed also that your logic is a little bit flawed, so I’ve edited it to what I think looks right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently asked a question regarding IE8 issue. After some time the problem was
I recently asked a question about formatting JavaScript code in Vim. And I've also
I recently asked this question here and got some great answers! Custom SQL GROUP
I recently asked a question about some problems I was having getting MIT Kerberos
I've recently asked a question regarding best ways of separating business logic from data
I recently asked a question and posted some code, to which a suggestion was
I recently asked a question about structs, and optimizing some overloaded operators. The original
I recently asked a question relating to the javascript not working on my site
I recently asked this question https://softwareengineering.stackexchange.com/questions/129076/go-instead-of-c-c-with-cgo and got some very interesting input. However there's
I recently asked this question regarding pulling beans out of an applicationContext. The answer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.