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

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 :: react native class component short code 
Javascript :: react native time set state 
Javascript :: rotate image javascript base64 
Javascript :: get time in between two dates javascript dayjs 
Javascript :: how to render array buffer binary audio js 
Javascript :: wast node 
Javascript :: Plumsail To change the modal popup window size you can try injecting the CSS to the SharePoint list view page 
Javascript :: Plumasil - new item button text 
Javascript :: ongobd add key value to record 
Javascript :: create user controller 
Javascript :: angular universal prerender 
Javascript :: pass mltiple valuesthorugh context in react 
Javascript :: javascript For some reason my content within an array is not printing out to the screen 
Javascript :: getting json from response using getSync method 
Javascript :: angularjs Uncaught ReferenceError: myFunction is not defined at HTMLInputElement.onkeyup 
Javascript :: How to set up path paramater in angular and access in the controller 
Javascript :: Wait for AngularJS Service to finish running 
Javascript :: Navigating to another Screen when a button is tapped in React Native 
Javascript :: react-native installation error with npx react-native 
Javascript :: js generate pnh 
Javascript :: Get value by key from json array 
Javascript :: select the value of dropdownMenu with Semantic ui react 
Javascript :: mustache tutorial javascript 
Javascript :: set of these properties: in js 
Javascript :: Add Imaginary Property To Object 
Javascript :: Another Bind() Example 
Javascript :: SordMap elo 
Javascript :: number of substring in a string 
Javascript :: Create A JSON From 2D Array Example 
Javascript :: react mui pagination change text color site:stackoverflow.com 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =