What's new

Closed Bakit po ganto walang lumalabas external javascript

Status
Not open for further replies.
You have to call your function ate. See the image, the color red.

Code:
Your variables must be:

var subjectOne = 50;
var subjectTwo = 90;

var answer = (subjecOne + subjectTwo) / 2;
 

Attachments

Plus mo pa na walang age() ka na tinatawag TS
Eto pa kasi binigay saamen ng prof namin

PROBLEM MAKES PERFECT

// create a program to determine if the age is qualified to Vote.
function age(){
var age = 18;
if (age >= 18) { document.write("QUALIFIED TO VOTE");}
else{ document.write("NOT QUALIFIED"); }
}

// create a program to determine if the number is odd or even
function oddeven(){
var num = 19;
if (num%2== 0) { document.write("EVEN");}
else{ document.write("ODD"); }
}


// create a program to determine if the number is positive, negative or zero
// --
// --
// --

// create a program to find a maximum between two numbers
//--
//--
//--
//--

//create a program to determine if the character is alphabet, number or special
function char(){
var myChar = "3";
if (myChar >='a' && myChar <='z') {
document.write(myChar+" is Alphabet");
// create a program to determine if the alphabet is consonant or vowel
}
else if (myChar >=0 && myChar <=9){
document.write(myChar+" is number");
}
else{document.write("Special Characters"); }
}

//Create a program that will compute the Average Grade of two subject and determine if passed or failed
function average(){
var subject1 = 50;
var subject2 = 90;
var ans = (subject1 + subject2)/2;
if (ans >= 75 ) {
document.write("PASSED");
}
else{
document.write("FAILED");
}
}

PRAKTISS PO TAU!! Goodluck !!
 
Ganito kasi. May isang .html file ka na may nakalink na isang external JS na file.
Sa loob ng JS mo, may function kang tinawag.


In the first place, hindi talaga gagana ang app mo dahil ang function, na hindi tinawag, hindi naman magrrun, in simple terms.

May function, may magc-call.


So may function age() ka, dapat sa body ng html file mo, may ganito kang script.

<script>
age();
</script>

Ngayon, pasok tayo sa function age mo.

Ang unang mali dyan, may subject ka na initialized mo.

Pero sa loob ng ans variable, may subject1 & subject2 kana.

I think, mali ang naming mo.

Dapat sa halip na subject parehas, subject1 and subject2 ang sagot para magfit doon sa variable ans formula.

Double initialization ang ginawa mo, doon pa lang, error na.

Sa if else mo naman, ang problem is walang delimiter.

Dapat, document.write("PASSED");

saka document.write("FAILED");

May semi colon.

More power sa'yo and don't give up!
 
Ganito kasi. May isang .html file ka na may nakalink na isang external JS na file.
Sa loob ng JS mo, may function kang tinawag.


In the first place, hindi talaga gagana ang app mo dahil ang function, na hindi tinawag, hindi naman magrrun, in simple terms.

May function, may magc-call.


So may function age() ka, dapat sa body ng html file mo, may ganito kang script.

<script>
age();
</script>

Ngayon, pasok tayo sa function age mo.

Ang unang mali dyan, may subject ka na initialized mo.

Pero sa loob ng ans variable, may subject1 & subject2 kana.

I think, mali ang naming mo.

Dapat sa halip na subject parehas, subject1 and subject2 ang sagot para magfit doon sa variable ans formula.

Double initialization ang ginawa mo, doon pa lang, error na.

Sa if else mo naman, ang problem is walang delimiter.

Dapat, document.write("PASSED");

saka document.write("FAILED");

May semi colon.

More power sa'yo and don't give up!
Ayaw boss e check mo nga to
 

Attachments

Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Javascript</title>
</head>
<body>
  <script>
    
   //create a program to determine if the age is qualified to vote

    //function to check if the voter is qaulified or not
    function age(age) {
      if (age >= 18) {
        document.write("<h3 style='color: red;'>Your age is " + age + " and you are qualified to vote." + "</h3>");
      }
      else {
        document.write("<h3 style='color: red;'>Your age is " + age + " and you are not qualified to vote." + "</h3>");
      }
    }
    
    //call the function
    age(18)
    age(25)
    age(17)

  </script>
</body>
</html>
 

Attachments

Mar
Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Javascript</title>
</head>
<body>
  <script>
   
   //create a program to determine if the age is qualified to vote

    //function to check if the voter is qaulified or not
    function age(age) {
      if (age >= 18) {
        document.write("<h3 style='color: red;'>Your age is " + age + " and you are qualified to vote." + "</h3>");
      }
      else {
        document.write("<h3 style='color: red;'>Your age is " + age + " and you are not qualified to vote." + "</h3>");
      }
    }
   
    //call the function
    age(18)
    age(25)
    age(17)

  </script>
</body>
</html>



Marameng salamat po sa pag tulong
 
Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Javascript</title>
</head>
<body>
  <script>
   
   //create a program to determine if the age is qualified to vote

    //function to check if the voter is qaulified or not
    function age(age) {
      if (age >= 18) {
        document.write("<h3 style='color: red;'>Your age is " + age + " and you are qualified to vote." + "</h3>");
      }
      else {
        document.write("<h3 style='color: red;'>Your age is " + age + " and you are not qualified to vote." + "</h3>");
      }
    }
   
    //call the function
    age(18)
    age(25)
    age(17)

  </script>
</body>
</html>
Sir pahinge nga po sample ng external niyo?
 
Pa try code mo ate, gusto ko pa matuto,kahit questions lang
Eto po

<!DOCTYPE html>
<html lang="en">
<head>
<title>Javascript</title>
</head>
<body>
<script>

//create a program to determine if the age is qualified to vote

//function to check if the voter is qaulified or not
function age(age) {
if (age >= 18) {
document.write("<h3 style='color: red;'>Your age is " + age + " and you are qualified to vote." + "</h3>");
}
else {
document.write("<h3 style='color: red;'>Your age is " + age + " and you are not qualified to vote." + "</h3>");
}
}

//call the function
age(18)
age(25)
age(17)

</script>
</body>
</html>
Hinde ito saaken
 
Eto po

<!DOCTYPE html>
<html lang="en">
<head>
<title>Javascript</title>
</head>
<body>
<script>

//create a program to determine if the age is qualified to vote

//function to check if the voter is qaulified or not
function age(age) {
if (age >= 18) {
document.write("<h3 style='color: red;'>Your age is " + age + " and you are qualified to vote." + "</h3>");
}
else {
document.write("<h3 style='color: red;'>Your age is " + age + " and you are not qualified to vote." + "</h3>");
}
}

//call the function
age(18)
age(25)
age(17)

</script>
</body>
</html>
Hinde ito saaken
Malapit na ako sa balay, update kita maya ate
 
Status
Not open for further replies.

Similar threads

Back
Top