Javascript is an interpreted, high level programming language developed and
designed for web development. But now it is extensively being used in various
fields rather than only web development after the development of node js.
//The pop() method removes the last element from an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop();
//>> "Mango"
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
//Single line comments with 2 forward slashes
/*
Multi-line comments
with start and closing comment symbol
*/
//You can also use comments for Functions,Classes and Class Methods.
/*
Function/Class methods comments will display the comment to developers.
Displays comment when hovering over the function/method name.
Might also display comment with intellisense feature.
Should work in most IDE with intellisense for language in use.
May need to install and set correct intellisense for language in use.
To be placed at top of functions, classes or class methods.
*/
//EXPLANATION
/**
* Function/Class/Class-method Description
** Double asterisk adds list items
** You can add url for online resources just type url
** there as several @ options see https://jsdoc.app/ for list and description
** data-type is best typed in caps
** intellisense may color code data-type typed in caps
** Format of @options below
* @option | {data-type} | parameter-name | description
* @return-option | {data-type} | description
*/
//IMPLEMENTATION EXAMPLE (Use example then call the function to see how it works)
/**
* Alerts a message to user
** Note: doesn't display title
** https://jsdoc.app
* @param {STRING} message Message to user
* @param {STRING} username This is username
* @param {NUMBER} age Age of User
* @returns {BOOLEAN} Boolean
*/
function AlertSomething(message,username,age){
alert(message + username + " . You are " + age + " years old");
return true;
}
AlertSomething("Hello ", "Alice", 25);
//The shift() method removes the first array element and "shifts" all other elements to a lower index.
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
// The shift() method returns the value that was "shifted out": >> Banana
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
- JavaScript is a multiparadigm programming language with the support of functional and objective paradigms.
- JavaScript was built in 10 days.
- It is Dynamic types programming Language.
- JavaScript is used to add the fuctionalites to the web applications.
JavaScript is a text-based programming language used both on the client-side and server-side that allows you to make web pages interactive. Where HTML and CSS are languages that give structure and style to web pages, JavaScript gives web pages interactive elements that engage a user. I personally would recommend JavaScript if you are starting off, because it is an easy programming language that can do a lot. Example: var yes = "gogurt" console.log(yes) OR var yes = 1 var e = 2 var noob = yes + e console.log(noob) OR console.log(1+2)
async function sendMe()
{
let r =await fetch('/test', {method: 'POST', body: JSON.stringify({a:"aaaaa"}), headers: {'Content-type': 'application/json; charset=UTF-8'}})
let res = await r.json();
console.log(res["a"]);
}
//combine the name with the age from object javascript function challenges
const customerAndAge = (obj) => {
let array = [];
for (let key in obj) {
array.push(`Customer Name :${key} , Age :${obj[key]}`);
} return array;
};
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
What is JavaScript used for?
Adding interactive behavior to web pages. JavaScript allows users to interact with web pages. ...
Creating web and mobile apps. Developers can use various JavaScript frameworks for developing and building web and mobile apps. ...
Building web servers and developing server applications. ...
Game development.
JavaScript, often abbreviated as JS, is a programming language that conforms
to the ECMAScript specification.
JavaScript is high-level, often just-in-time compiled, and multi-paradigm.
It has curly-bracket syntax, dynamic typing, prototype-based object-orientation,
and first-class functions.
function world(params){
//Code to be executed when the function is called.
}
world()
//Explaination
//'world' in the function is the name of the function.
//There are brackets after function name. Those are use to push parameters
//The forth line Calls the function named 'world'
Javascript is a very high-level coding language used in HTML and many of your
favorite websites, Couldn't be made without JS. Javascript can be used
Front-Back end and JavaScript is popularly known for Discord.js and
react.js.
Example:
const discord = require = ('discord.js');
When using js its always good to remember to finish off your code with ";"
console.log("JavaScript is the most powerful and most efficient language in the world")
//Here's Why
You can manage the Server with this using Node.JS and Express.Js
These are the most famous libs for JS
For Building Mobile App
. React Native and Redux
For Building Windows App
. Electron
For Machine learning
. TensorFlow JS
The Document Object Model (DOM) is a programming interface for web documents.
It represents the page so that programs can change the document structure,
style, and content. The DOM represents the document as nodes and objects;
that way, programming languages can interact with the page.
//The length property provides an easy way to append a new element to an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits[fruits.length] = "Kiwi"
// >> ["Banana", "Orange", "Apple", "Mango" , "Kiwi"]
//if you find this answer is useful ,
//upvote ⇑⇑ , so the others can benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
JavaScript is a text-based programming language used both on the client-side
and server-side that allows you to make web pages interactive.
Where HTML and CSS are languages that give structure and style to web pages,
JavaScript gives web pages interactive elements that engage a user.
JavaScript, often abbreviated JS, is a programming language that is one
of the core technologies of the World Wide Web, alongside HTML and CSS.
Over 97% of websites use JavaScript on the client side for web page behavior,
often incorporating third-party libraries.
function square(arr) {
const newArr = arr.map(x => x * x );
return newArr ;
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
//First, declare a variable for initial value
const doWhile = 10;
//Second, get do-while and write what to execute inside do bracket.
//Then, write ++/-- according to your condition.
//Lastly, inside while bracket write your condition to apply.
do{
console.log(doWhile)
doWhile--
}while(doWhile >= 0)
JavaScript is basically a programming language for the web,
you can see JavaScript as the official language for web development
and the only programming language that allows you to build
frontend applications (web interface),
backend applications (server+database) down to mobile applications,
and machine learning.
// we create a new JS engine with the object "gt" as globalThis
// gt can now be treated like globalThis.
try (JScriptEngine engine = new JScriptEngine(new JsGlobalThis(),"gt")) {
/* call your js code here */
}
//The unshift() method adds a new element to an array (at the beginning), and "unshifts" older elements:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.unshift("Lemon");
//The unshift() method returns the new array length : >> 5
/*if you find this answer is useful ,
upvote ⇑⇑ , so the others can benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)*/
def print_all_numbers_then_all_pair_sums(numbers):
print "these are the numbers:"
for number in numbers:
print number
print "and these are their sums:"
for first_number in numbers:
for second_number in numbers:
print first_number + second_number
// Load HTTP module
const http = require("http");
const hostname = "127.0.0.1";
const port = 8000;
// Create HTTP server
const server = http.createServer(function(req, res) {
// Set the response HTTP header with HTTP status and Content type
res.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body "Hello World"
res.end('Hello World
');
});
// Prints a log once the server starts listening
server.listen(port, hostname, function() {
console.log(`Server running at http://${hostname}:${port}/`);
})
// getting all required elements
const searchWrapper = document.querySelector(".search-input");
const inputBox = searchWrapper.querySelector("input");
const suggBox = searchWrapper.querySelector(".autocom-box");
const icon = searchWrapper.querySelector(".icon");
let linkTag = searchWrapper.querySelector("a");
let webLink;
// if user press any key and release
inputBox.onkeyup = (e)=>{
let userData = e.target.value; //user enetered data
let emptyArray = [];
if(userData){
icon.onclick = ()=>{
webLink = `https://www.google.com/search?q=${userData}`;
linkTag.setAttribute("href", webLink);
linkTag.click();
}
emptyArray = suggestions.filter((data)=>{
//filtering array value and user characters to lowercase and return only those words which are start with user enetered chars
return data.toLocaleLowerCase().startsWith(userData.toLocaleLowerCase());
});
emptyArray = emptyArray.map((data)=>{
// passing return data inside li tag
return data = `<li>${data}</li>`;
});
searchWrapper.classList.add("active"); //show autocomplete box
showSuggestions(emptyArray);
let allList = suggBox.querySelectorAll("li");
for (let i = 0; i < allList.length; i++) {
//adding onclick attribute in all li tag
allList[i].setAttribute("onclick", "select(this)");
}
}else{
searchWrapper.classList.remove("active"); //hide autocomplete box
}
}
function select(element){
let selectData = element.textContent;
inputBox.value = selectData;
icon.onclick = ()=>{
webLink = `https://www.google.com/search?q=${selectData}`;
linkTag.setAttribute("href", webLink);
linkTag.click();
}
searchWrapper.classList.remove("active");
}
function showSuggestions(list){
let listData;
if(!list.length){
userValue = inputBox.value;
listData = `<li>${userValue}</li>`;
}else{
listData = list.join('');
}
suggBox.innerHTML = listData;
}
let suggestions = [
"Channel",
"CodingLab",
"CodingNepal",
"YouTube",
"YouTuber",
"YouTube Channel",
"Blogger",
"Bollywood",
"Vlogger",
"Vechiles",
"Facebook",
"Freelancer",
"Facebook Page",
"Designer",
"Developer",
"Web Designer",
"Web Developer",
"Login Form in HTML & CSS",
"How to learn HTML & CSS",
"How to learn JavaScript",
"How to become Freelancer",
"How to become Web Designer",
"How to start Gaming Channel",
"How to start YouTube Channel",
"What does HTML stands for?",
"What does CSS stands for?",
];
You can easily learn the javascript for free with below resource.
//https://www.codingninjas.com/codestudio/guided-paths/basics-of-javascript?utm_source=seo_links&utm_medium=QA_Submission&utm_campaign=SEO_Backlink_Traffic
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Loop {
function loop() public {
// for loop
for (uint i = 0; i < 10; i++) {
if (i == 3) {
// Skip to next iteration with continue
continue;
}
if (i == 5) {
// Exit loop with break
break;
}
}
// while loop
uint j;
while (j < 10) {
j++;
}
}
}
{"copyright":"Ian Griffin","date":"2022-10-21","explanation":"Looking north from southern New Zealand, the Andromeda Galaxy never gets more than about five degrees above the horizon. As spring comes to the southern hemisphere, in late September Andromeda is highest in the sky around midnight though. In a single 30 second exposure this telephoto image tracked the stars to capture the closest large spiral galaxy from Mount John Observatory as it climbed just over the rugged peaks of the south island's Southern Alps. In the foreground, stars are reflected in the still waters of Lake Alexandrina. Also known as M31, the Andromeda Galaxy is one of the brightest objects in the Messier catalog, usually visible to the unaided eye as a small, faint, fuzzy patch. But this clear, dark sky and long exposure reveal the galaxy's greater extent in planet Earth's night, spanning nearly 6 full moons.","hdurl":"https://apod.nasa.gov/apod/image/2210/andromeda-over-alps.jpg","media_type":"image","service_version":"v1","title":"Andromeda in Southern Skies","url":"https://apod.nasa.gov/apod/image/2210/andromeda-over-alps1100.jpg"}
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Statements</h2>
<p>A <b>JavaScript program</b> is a list of <b>statements</b> to be executed by a computer.</p>
<p id="demo"></p>
<script>
var x, y, z; // Declare 3 variables
x = 5; // Assign the value 5 to x
y = 6; // Assign the value 6 to y
z = x + y; // Assign the sum of x and y to z
document.getElementById("demo").innerHTML =
"The value of z is " + z + ".";
</script>
</body>
</html>
JavaScript often abbreviated JS,
is a programming language
that is one of the core technologies of the World Wide Web,
alongside HTML and CSS.
As of 2022, 98% of websites use JavaScript on the client side for webpage behavior,
often incorporating third-party libraries.
All major web browsers have a dedicated JavaScript
engine to execute the code on users' devices.