0% found this document useful (0 votes)
4 views6 pages

Let B

The document contains multiple JavaScript functions and HTML elements for various functionalities, including conditional statements for selling items based on user input, grading system based on marks, money transfer confirmation, and form handling. It also includes loops for displaying odd numbers and a simple grading system in a web page. Overall, it demonstrates basic programming concepts and user interaction in JavaScript.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

Let B

The document contains multiple JavaScript functions and HTML elements for various functionalities, including conditional statements for selling items based on user input, grading system based on marks, money transfer confirmation, and form handling. It also includes loops for displaying odd numbers and a simple grading system in a web page. Overall, it demonstrates basic programming concepts and user interaction in JavaScript.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

let b='buss', e='emp', s=2000;

if(b=="bus" || e=="emp")

if(b=="bus")

console.log("waxaan ku iibineeynaa waxaad dooneeysid !");

if(s==2000)

console.log("waxaan kuu ibineynaa dhul");

if(s==1000)

console.log("waxaan kuu ibineynaa gari");

if(s==800)

console.log("waxaan kuu ibineynaa Bajaj");

else{

console.log("naga raali noqo madan buxin sharuudihii !");

2- function add(marks) {

let grade;
switch(true) {

case (marks > 94 && marks < 101 ):

grade = 'A+ '

case (marks > 89.99&& marks < 95 ):

grade = 'A '

break;

case (marks > 84 && marks < 90 ):

grade = 'B+ '

break;

case (marks > 80 && marks < 85 ):

grade = 'B '

break;

case (marks >=60 && marks < 80 ):

grade = 'C '

break;

case (marks < 60 && marks >= 0 ):

grade = 'F '

break;

default:

grade = 'Invalid marks'

return grade;

const marks = prompt("Enter your marks ");

document.write("marks : " + marks , "\n Grade : " + add(marks) );\


3- function Pass() {

var v = confirm("Are you sure you want send money");

if (v ==true) {

var pwd = prompt("Enter password");

if (pwd == 123) {

var phone = prompt("Enter a number");

var money= prompt("Enter a mount of money ");

if (money > 30) {

document.write("your balance is not sufficient");

} else {

var info = "You send money to : " + phone + " <br> " + "A mount of money : " + money;

document.write(info);

} else {

document.write("Please check your password");

} else {

alert("cancel")

4-function msg()

setTimeout(

function()

alert("Welcome to HU");
},2000

);

</script>

<input type="button" value="click" onclick="msg()"/>

5- function passvalue()

var name = document.form1.name.value;

var age = document.form1.age.value;

var phone = document.form1.phone.value;

alert("Name is : "+name+"\n Age: "+age+"\n Phone: "+phone);

</script>

<form name="form1">

Enter Name:<input type="text" name="name"/><br>

Enter Age : <input type="text" name="age"/><br>

Enter Phone:<input type="text" name="phone"/><br><br>

<input type="button" value="printName" onclick="passvalue()"/>

</form>

6- i = 0;

while (i < 15) {

if (i % 2 == 1) {

document.write(i + "<br>")

i++

}
/*

for (i = 20; i > 0; i --) {

if (i % 2 == 0) {

document.write(i + "<br>")

*/

7-<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Document</title>

</head>

<body>

<script>

function exm(){

var g =85;

if(g>100 || g<0)

document.write("Sorry this is not grade please check it "+g);

}
else if(g >94 && g <101)

document.write ("A+: "+g);

else if(g >89.99 && g <95)

document.write ("A: "+g);

else if(g >84 && g <90)

document.write ("B+: "+g);

else if(g >=60 && g <65)

document.write ("D+: "+g);

else

document.write ( "F: "+g);

</script>

<button onclick =" exm()"> submit</button>

</body>

</html>/

You might also like