Javascript else if and getElementById issue

Hello

I
found a problem in my quiz today to solve a problem in javascript about if-statment about calculating GPA , and I answer the question like this way
I Found some issue to assign a value by name to integer .

var student = document.getElementById("student-name");
var math = document.getElementById("g1");
var mathcridit = document.getElementById("math-cridit");
var computer= document.getElementById("g2");
var compcridit=document.getElementById("compuetr-cridit");
var scie= document.getElementById("g3");
var scicridit=document.getElementById("sci-cridit");
var tot = document.getElementById("total");


math.addEventListener("input", grade);
mathcridit.addEventListener("input",calc)
computer.addEventListener("input",grade);
compcridit.addEventListener("input",calc);
scie.addEventListener("input",grade);
scicridit.addEventListener("input",calc);
function grade()
{
  if(document.getElementByIName('g')=='A')
    {
     return document.getElementByName('g')== 4;
    }
  else if (document.getElementByName('g')=='B')
    {
      return document.getElementByName('g')==3;
    }
  else if (document.getElementByName('g')=='C')
    {
      return document.getElementByName('g')==2;
    }
  else if (document.getElementByName('g')=='D')
    {
        return document.getElementByName('g')==1;
     
    }
 else  (document.getElementByName('g')=='F')
  {
    return 0;
  }
  
}
function calc() {
  var m = parseFloat([math.getElementByID("g1")].value);
  var c = parseFloat([computer.getElementById("g2")].value) ;
  var s = parseFloat([scie.getElementById("g3")].value);
   var mc = parseFloat(mathcridit.value) ;
  var cc = parseFloat(compcridit.value) ;
    var sc = parseFloat(scicridit.value) ;
    
  
 alert(tot.innerHTML = "your GPA is " + ((m*mc)+(c*cc)+(s*sc))/11);
}
<header>
</header>
<main>
  <h4>Enter the information:</h4>
  <p>
   Student Name: <input id="student-name" type="text">  E-mail Address: <input id="student-name" type="text"> <br>
    Mathmatics :<input name="g" id="g1" type="text"><br>
   Mathmatic cridit hours: <input id="math-cridit"><br>
    Computer :<input name="g" id="g2" type="text"><br>
    Computer cridit hours:<input id="computer-cridit"><br>
    Scince:<input name="g" id="g3" type="text"><br>
        Scince cridit hour :<input id="sci-cridit">
    <input id="total">


Source: stackoverflow-javascript

Is it possible to write a return array in If clause

I have a code for my website where i want certain usergroups to view certain files/filesextensions.
i have defined all prefererences in a return array and then simply made two of them, showing one if usergroup equals (eg $k=1), showing two if usergroup equals $k2.

but it does not work and i dont know why… any ideas? this is my code below..
thanks for your help in advance!

$k=1,2,3 depending on premium user level

if ($k==1) {

  return array(

    // Basic settings
    'hide_dot_files'            => true,
    'list_folders_first'        => true,
    'list_sort_order'           => 'natcasesort',
    'theme_name'                => 'bootstrap',
    'external_links_new_window' => true,
    // Hidden files
    'hidden_files' => array(
        '.ht*',
        '*/.ht*',
        'resources',
        'resources/*',
        'analytics.inc',
        'header.php',
		'cont.php',
		 'shoutbox.php',
		  'userinfo.php',
		  'stats.php',
		  'stats.html',
        'footer.php',
		'phpSecurePages/*',
		'phpSecurePages',
		'uploadify',
		        '*.docx',
		'*.pdf',
		'*.jpg',
		'*.jpeg',
		'*.doc',
		'*.PDF',
		'*.JPG',
		'*.JPEG',
		'*.DOC',
    etc

); 
      } else 
      { 
      return array(

    // Basic settings
    'hide_dot_files'            => true,
    'list_folders_first'        => true,
    'list_sort_order'           => 'natcasesort',
    'theme_name'                => 'bootstrap',
    'external_links_new_window' => true,
    // Hidden files
    'hidden_files' => array(
        '.ht*',
        '*/.ht*',
        'resources',
        'resources/*',
        'analytics.inc',
        'header.php',
		'cont.php',
		 'shoutbox.php',
		  'userinfo.php',
		  'stats.php',
		  'stats.html',
        'footer.php',
		'phpSecurePages/*',
		'phpSecurePages',
		'uploadify',
); }


Source: stackoverflow-php

Creating a Bracketed Sales Commission Calculator with Javascript

I’m trying to create a calculator using javascript syntax for a realtor client. She wants to use it to show her clients what her commission amount would be. Here’s the parameters she gave me. They are bracketed (like income taxes):

  • 0.575% up to $100,000
  • any amount in excess of $100k, up to $1m is charged at 0.5%
  • any amount in excess of $1m is charged at 0.25%

Therefore:

  • The first $100k is $575
  • The first $1m is $5075 ($575 for the $100k plus $4500 for the next $900k)

Here is my code, where the input is x.

(function(){
    if(x <= 100000) return x*0.00575;
    if(x > 100000 && < 1000000) return ((x-100000)*0.005+575);
    if(x >= 1000000) return ((x-1000000)*0.0025+5075);
})();

Is this correct? What have I done wrong?


Source: stackoverflow-javascript