JavaScript programs

JavaScript programs

Share

This page will help people without the knowledge of programming to start from scratch up the level o

16/11/2022

“The purpose of software engineering is to control complexity, not to create it.” — Pamela Zave

10/11/2022

In programming, you use conditionals to know which block of code to execute when certain conditions are met.

And in SQL, you can use the CASE statement (along with WHEN, THEN, & ELSE) to do this.

08/09/2022

Lucky dude...

U.S govt. agrees to reduce Hushpuppi’s sentence to 11yrs for helping detectives solve other criminal cases

Prosecutors in the United States have asked a federal judge to sentence Ramon ‘Hushpuppi’ Abbas to 11 years in prison and three years of supervised release for his role in a multinational conspiracy that earned him millions of dollars between 2019 and 2020.

According to Peoples Gazette, American attorneys led by Khaldoun Shobaki in the U.S. Central District of California (Los Angeles) argued that Hushpuppi should also be asked to pay $1.7 million in restitution; $500K in fines and $100 in administrative fees, per recommendations submitted ahead of his sentencing on September 21.

The development came more than two years after the infamous Internet fr@ud ringleader was arrested in Dubai in June 2020 for driving multiple schemes that targeted victims in Europe and the United States. He pleaded guilty in April 2021 after prosecutors discovered his involvement in a separate conspiracy to defraud a Qatari businessperson, who lost $810K in the process of trying to obtain an elusive loan to set up an international school.

The prosecutors argued that their sentencing recommendations were appropriate considering the gravity of Hushpuppi’s crimes. The government said one of his co-conspirators Ghaleb Alaumary was sentenced to 140 years in jail for violating the same set of criminal codes.

“By his own admission, during just an 18-month period defendant conspired to launder over $300 million,” the prosecutors said. The government said Mr Abbas’ criminal path was premeditated, even though he had a clear chance to choose a rewarding career as a law-abiding citizen.

Mr Abbas’ sentencing, the government argued, was reduced because he cooperated with detectives on our criminal cases under investigation and prosecution in American courts.

24/09/2021

//Fibonacci series less than 40



document.write("Using while loops ");
var i = 0, j = 1, k;
document.write("Fibonacci series less than 40");
while(i

24/09/2021



Arrays!!!

var students = new Array("John", "Ann", "Aaron", "Edwin", "Elizabeth");
Array.prototype.displayItems=function(){
for (i=0;i

24/08/2021






http://www.Daso.edu.org

alert('Please Upvote')


body{
background-color: ;
}
.red{
width: 90px;
height: 90px;
border-radius: 50px;
border-style: solid red;
color: steelblue;
background-color: red;
margin-left: 10px;
margin-top: 10px;
}
.green{
width: 90px;
height:90px;
border-radius: 50px;
border-style: solid rgb(0,255,64);
background-color: rgb(0,255,64);
margin-left: 10px;
margin-top: 10px;
}
.yellow{
width: 90px;
height:90px;
border-radius: 50px;
border-style: solid (245,252,3);
background-color:rgb(245,252,3);
margin-left: 10px;
margin-top: 8px;

}
.green:active{
background-color:rgba(0,255,0);
}

.main{
width: 115px;
height: 305px;
background: linear-gradient(90deg, blue, yellow, rgb(204,204,255));
border:solid black;
background-color: ;
border-radius: 10px;
box-shadow: 0 10px 0 10px rgb(37,37,37);
margin-left: 200px;
}
.poor{
width: 30px;
height: 200px;
border-style: none;
background: repeating-linear-gradient( 90deg,
silver 0px,
green 40px,
orange 40px,
pink 80px);
margin-left: 40px;
margin-top: 20px;
border-top: solid black;
border-bottom: solid black;
}
{
width: 100px;
height:70px;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
background-color: #000;
margin-bottom: 50px;
margin-left: 7px;
}
h1{
text-align: center;
}
footer{
text-align: center;
color:blue;
}



Street Light






©right:2020 Nov 2 nd By:Engineer Abunku Emmanuel Terdoo



19/08/2021

As JavaScript is executed on client side and is generally a bad idea to expose the database directly to the user (even if it is read-only), you should create a server side service (use any script or programming language you prefer or know) which will provide a necessary interface between the client (running your JavaScript code) and the database.
A good example is to create an API and communicate with it via AJAX calls. You can send requests with additional information needed for data selection, filtering and sorting. This information can be included in the request's GET or POST (or any other) method (verb) as defined by the HTTP protocol.
Example:
JavaScript binds to a click event on a DOM element (button to load some info).
User clicks and an event is triggered. JavaScript function handles this event.
This JavaScript function creates a request to be sent to the server. Say that it is a JSON string object: { "controller" : "Users", "method" : "getActiveUserCount" }.
This JSON string is sent to the service on the server via a HTTP POST request.
An animation is started to give the user some idea that a process is being executed in the background (optional).
The service picks it up and handles it = executes the getActiveUserCount method of the Users class (controller). The result is also a JSON string (an object), for example: { "status" : "ok", "numberOfActiveUsers" : 351 }
The client picks up this response and checks the JSON object's status value (if "ok", which it is in this example, continues) and then displays the numberOfActiveUsers value from the same returned object.
The animation is stopped. (optional).
The click event has been fully handled.

18/08/2021

Making a calculator in a simple way using html ...css comes. Later


HTML Calculator




















Solution is


18/08/2021

//Playing with arrays is fun!!
var val=[9,4,6,2,8,10,15];
//square all values in array
const valSquare= val.map(val=>Math.sqrt(val));
console.log(valSquare);
Output1: ********
//multiply all values by two
const valTimesTwo= val.map(val=>val*2);
console.log(valTimesTwo);
Output2:**********
//multiply all values by power 2
const valPowerTwo= val.map(val=>val**2);
console.log(valPowerTwo);
Output3:********
// sort values from the lowest to the highest
const valSort= val.sort()
console.log(valSort);
// result is weird
Output4:*********
const
mySortVal=val.sort((a,b)=>a-b);
console.log(mySortVal);
// better result in ascending order
Output5:********
const myValSort= val.sort((a,b)=>b-a);
console.log(myValSort);
// better result in descending order
Output6: *******
//Add all values together using loop and reduce
let valSum=0;
for(let i=0; i=5){
valVal.push(val[i]);
}
}
console.log(valVal);
Output14:******
NB: Let see ur output(s)

14/08/2021

ages= [12,34,15,5,35,45,33,23,17,27,28,18];
//sort age in ascending order
const sortAge=ages.sort(
((a,b)=>a-b),0);
console.log(sortAge);
// multiply ages by two
const ageTimesTwo=ages.map(age=>age*2);
console.log(ageTimesTwo);
//filter ages
for(let i=0; ib-a),0);
console.log(sortAges);
//sum all ages using for loop
let sumAge= 0;
for( let i=0; i total + ages, 0);
console.log(agesSum);
// find the sqrt of ages
const sqrootAge= ages.map(ages=> Math.sqrt(ages));
console.log(sqrootAge);
//find the sqroot and ages times two
const ageComplex= ages
map(ages=>Math.sqrt(ages))
map(ages=>ages*2);
console.log(ageComplex);

06/08/2021

function showPrimes(n) {

for (let i = 2; i < n; i++) {
if (!isPrime(i)) continue;

alert(i); // a prime
}
}

function isPrime(n) {
for (let i = 2; i < n; i++) {
if ( n % i == 0) return false;
}
return true;
}

Want your school to be the top-listed School/college in Abuja?

Click here to claim your Sponsored Listing.

Location

Category

Telephone

Address


Abuja