Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

code checker javascript

function shourtcut(s1,s2) {
let chars1 = s1.charAt(0);
let chars2 = s2.charAt(0);
console.log(chars1 + chars2);
return chars1 + chars2;
}
Comment

how to check my javascript code

function CalculateCGPA(){
       
        var os=document.getElementById("t1").value;
        if(os="")
        os=0;
        
        var gs=document.getElementById("t2").value;
        if(gs="")
        gs=0;
        var dc=document.getElementById("t3").value;
        if(dc="")
        dc=0;
        var xus=document.getElementById("t4").value;
        if(xus="")
        xus=0;
        var abd=document.getElementById("t5").value;
        if(abd="")
        abd=0;
        document.getElementById("g1").innerHTML=letterGrade(os);
        document.getElementById("g2").innerHTML=letterGrade(gs);
        document.getElementById("g3").innerHTML=letterGrade(dc);
        document.getElementById("g4").innerHTML=letterGrade(xus);
        document.getElementById("g5").innerHTML=letterGrade(abd);
        var cgpa=(4*gradeWeight(os)+4*gradeWeight(gs)+4*gradeWeight(dc)+4*gradeWeight(xus)+4*gradeWeight(abd))/20;
        document.getElementById("2001").innerHTML=document.write(cgpa);










    }
    function letterGrade(mark){
        mark=parseInt(mark);
        if(mark>=90)
        mark='A';
        if(mark>=85)
        mark='A-';
        if(mark>=80)
        mark='B+';
        if(mark>=75)
        mark='B';
        if(mark>=70)
        mark='B-';
        if(mark>=65)
        mark='C+';
        if(mark>=60)
        mark='C';
        if(mark>=56)
        mark='C-';
        if(mark>=53)
        mark='D+';
        if(mark>=50)
        mark='D';
        if(mark>=40)
        mark='D-';
        if(mark<=39.9)
        mark='F';




    }
    function gradeWeight(mark){
        if(mark>=90)
        mark=4.0;
        if(mark>=85)
        mark=3.7;
        if(mark>=80)
        mark=3.3;
        if(mark>=75)
        mark=3.0;
        if(mark>=70)
        mark=2.7;
        if(mark>=65)
        mark=2.3;
        if(mark>=60)
        mark=2.0;
        if(mark>=56)
        mark=1.7;
        if(mark>=53)
        mark=1.3;
        if(mark>=50)
        mark=1.0;
        if(mark>=40)
        mark=0.7;
        if(mark<=39.9)
        mark=0.0;





    }


    document.getElementById("butn1").addEventListener("click", CalculateCGPA);
</script>
</html>
Comment

how to check my javascript code

<!DOCTYPE html>
<html>
<head> </head>
<style>
    table, tr,th, td {
  border: 1px solid;
}
</style>
<body>
    <center>
        <h1>CGPA CALCULATOR</h1>
        <table>
            <tr>
                <th style="color: black;">COURSE CODE </th>
                <th style="color: black;"> COURSE TITLE</th>
                <th style="color: black;"> UNITS</th>
                <th style="color: black;"> MARK</th>
                <th style="color: black;"> GRADE</th>
</tr>
<tr>
    <td>ITEC202</td>
    <td>Operating systems</td>
    <td>4</td>
    <td><input type="text" id="t1" value=""></td>
    <td id="g1"></td>

</tr>
<tr>
    <td>ITEC224</td>
    <td>Database programming</td>
    <td>4</td>
    <td><input type="text" id="t2" value=""></td>
    <td id="g2"></td>

</tr>
<tr>
    <td>ITEC230</td>
    <td>Rich Internet Application Development</td>
    <td>4</td>
    <td><input type="text" id="t3" value=""></td>
    <td id="g3"></td>

</tr>
<tr>
    <td>ITEC243</td>
    <td>Rich Internet Application Development</td>
    <td>4</td>
    <td><input type="text" id="t4" value=""></td>
    <td id="g4"></td>

</tr>
<tr>
    <td>ITEC259</td>
    <td>Digital Logic Design</td>
    <td>4</td>
    <td><input type="text" id="t5" value=""></td>
    <td id="g5"></td>

</tr>
<tr>
    <td colspan="3"><center><input type="button" id="butn1" value="Calculate CGPA" ></center></td>
    <th>CGPA:</th>
    <td id="2001"></td>
</tr>












        </table>

    


























    </center>
</body>
<script>
    function CalculateCGPA(){
       
        var os=document.getElementById("t1").value;
        if(os="")
        os=0;
        
        var gs=document.getElementById("t2").value;
        if(gs="")
        gs=0;
        var dc=document.getElementById("t3").value;
        if(dc="")
        dc=0;
        var xus=document.getElementById("t4").value;
        if(xus="")
        xus=0;
        var abd=document.getElementById("t5").value;
        if(abd="")
        abd=0;
        document.getElementById("g1").innerHTML=letterGrade(os);
        document.getElementById("g2").innerHTML=letterGrade(gs);
        document.getElementById("g3").innerHTML=letterGrade(dc);
        document.getElementById("g4").innerHTML=letterGrade(xus);
        document.getElementById("g5").innerHTML=letterGrade(abd);
        var cgpa=(4*gradeWeight(os)+4*gradeWeight(gs)+4*gradeWeight(dc)+4*gradeWeight(xus)+4*gradeWeight(abd))/20;
        document.getElementById("2001").innerHTML=document.write(cgpa);










    }
    function letterGrade(mark){
        mark=parseInt(mark);
        if(mark>=90)
        return 'A';
        if(mark>=85)
        return 'A-';
        if(mark>=80)
        return 'B+';
        if(mark>=75)
        return 'B';
        if(mark>=70)
        return 'B-';
        if(mark>=65)
        return 'C+';
        if(mark>=60)
        return 'C';
        if(mark>=56)
        return 'C-';
        if(mark>=53)
        return 'D+';
        if(mark>=50)
        return 'D';
        if(mark>=40)
        return 'D-';
        if(mark<=39.9)
        return 'F';




    }
    function gradeWeight(mark){
        if(mark>=90)
        return 4.0;
        if(mark>=85)
        return 3.7;
        if(mark>=80)
        return 3.3;
        if(mark>=75)
        return 3.0;
        if(mark>=70)
        return 2.7;
        if(mark>=65)
        return 2.3;
        if(mark>=60)
        return 2.0;
        if(mark>=56)
        return 1.7;
        if(mark>=53)
        return 1.3;
        if(mark>=50)
       return 1.0;
        if(mark>=40)
        return 0.7;
        if(mark<=39.9)
        return 0.0;





    }


    document.getElementById("butn1").addEventListener("click", CalculateCGPA);
</script>
</html>


Comment

js checker

// This is JSHint, a tool that helps to detect errors and potential
Comment

javascript code checker

var total = 0;
var limit = 10;

for (var i=0; i<limit; i++) {
  total+=i
};
console.log(total);
Comment

PREVIOUS NEXT
Code Example
Javascript :: default function parameters javascript 
Javascript :: array js 
Javascript :: react -native-config 
Javascript :: bs modal service angular pass data 
Javascript :: maximum number of an array 
Javascript :: code cat 
Javascript :: javaScript Math.log() Method 
Javascript :: sum an array of objects 
Javascript :: change string with string js 
Javascript :: how to add function in javascript 
Javascript :: Extension Google Chrome Create.. 
Javascript :: how to create variables using javascript 
Javascript :: javascript function with input value 
Javascript :: fastify testing 
Javascript :: change one element in array javascript 
Javascript :: millis javascript 
Javascript :: linkedin api v2 get email address 
Javascript :: is javascript loosely typed 
Javascript :: define conastant js 
Javascript :: tradingview custom data feed 
Javascript :: javascript make pong 
Javascript :: onClick button react send to another component 
Python :: minecraft 
Python :: uuid regex 
Python :: python count files directory 
Python :: how to make a letter animation in python 
Python :: cv2 grayscale 
Python :: bored 
Python :: httpie on windows 
Python :: keras plot history 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =