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
*/functionAlertSomething(message,username,age){alert(message + username +" . You are "+ age +" years old");returntrue;}AlertSomething("Hello ","Alice",25);
#include <stdio.h>
#define MAX100//function prototypes/*
This function will return o if 'ch' is vowel
else it will return 1
*/
char isVowel(char ch);/*
This function will eliminate/remove all vowels
from a string 'buf'
*/voideliminateVowels(char *buf);/*main function definition*/
int main(){
char str[MAX]={0};//read stringprintf("Enter string: ");scanf("%[^]s",str);//to read string with spaces//print Original stringprintf("Original string:%s
",str);//eliminate vowleseliminateVowels(str);printf("After eliminating vowels string:%s
",str);return0;}//function definitions
char isVowel(char ch){if( ch=='A'|| ch=='a'||
ch=='E'|| ch=='e'||
ch=='I'|| ch=='i'||
ch=='O'|| ch=='o'||
ch=='U'|| ch=='u')return0;elsereturn1;}voideliminateVowels(char *buf){
int i=0,j=0;while(buf[i]!=''){if(isVowel(buf[i])==0){//shift other character to the leftfor(j=i; buf[j]!=''; j++)
buf[j]=buf[j+1];}else
i++;}}
//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 in10 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.WhereHTML 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 JavaScriptif you are starting off, because it is an easy programming language that can do a lot.Example:var yes ="gogurt"console.log(yes)ORvar yes =1var e =2var noob = yes + e console.log(noob)ORconsole.log(1+2)
asyncfunctionsendMe(){let r =awaitfetch('/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 challengesconstcustomerAndAge=(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 asJS, 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-classfunctions.
functionworld(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 inHTML and many of your
favorite websites,Couldn't be made without JS.Javascript can be used
Front-Back end and JavaScript is popularly known forDiscord.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 WhyYou can manage the Serverwiththis using Node.JS and Express.JsThese are the most famous libs forJSForBuildingMobileApp.ReactNative and ReduxForBuildingWindowsApp.ElectronForMachine learning
.TensorFlowJS
TheDocumentObjectModel(DOM) is a programming interfacefor web documents.It represents the page so that programs can change the document structure,
style, and content.TheDOM represents the documentas nodes and objects;
that way, programming languages can interact with the page.
!!false===false!!true===true!!0===false!!parseInt("foo")===false// NaN is falsy!!1===true!!-1===true// -1 is truthy!!(1/0)===true// Infinity is truthy!!""===false// empty string is falsy!!"foo"===true// non-empty string is truthy!!"false"===true// ...even if it contains a falsy value!!window.foo===false// undefined value is falsy!!undefined===false// undefined primitive is falsy!!null===false// null is falsy!!{}===true// an (empty) object is truthy!![]===true// an (empty) array is truthy; PHP programmers beware!
let value = dummy`Ik ben ${name} en ik ben ${age} jaar`;functiondummy(){let str ="";
strings.forEach((string, i)=>{
str += string + values[i];});return str;}
//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 ( ͡~ ͜ʖ ͡°)
// '?.' is optional chaining// It is used to access a value of an object, just like '.'// However, if the value doesn't exist, it returns undefined, rather// than an error
/* Spread syntax ( ex. ...arrayName) allows an iterable such as an array expression or string
to be expanded in places where zero or more arguments (for function calls)
elements (for array literals) are expected, or an object expression to be
expanded in places where zero or more key-value pairs (for object literals)
are expected. *///examplefunctionsum(x, y, z){return x + y + z;}
JavaScript is a text-based programming language used both on the client-side
and server-side that allows you to make web pages interactive.WhereHTML 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 WorldWideWeb, alongside HTML and CSS.Over97%of websites use JavaScript on the client side for web page behavior,
often incorporating third-party libraries.
We use the double bang operator(!!) to check if a value is `truthy` or `falsy`.That means to check if a value is considered `true` or `false` by JavaScript.We use it when we need a boolean value according to a non-boolean value,for example if we need the value `false`if a string is empty,`true` otherwise.str="Double bang operator";// not empty strings are considered true by JSconsole.log(str ==true);// falseconsole.log(!!str);// true
str ="";// empty strings are considered false by JSconsole.log(str ==false);// trueconsole.log(!!str);// falseTruthy values :-Objects:{}// even empty objects-Arrays:[]// even empty Arrays-Not empty strings :"Anything"-Numbers other than 0:3.14-Dates:newDate()Falsy values :-Empty strings :""-0-null-undefined-NaN
functionsquare(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 valueconst 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)
OptionalChainingOperator?.Optional chaining syntax allows you to access deeply nested object properties
without worrying if the property exists or not.If it exists, great!If not,undefined will be returned.
JavaScript is basically a programming language for the web,
you can see JavaScriptas 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 =newJScriptEngine(newJsGlobalThis(),"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 ( ͡~ ͜ʖ ͡°)*/
times:[11,3,8,16,9,13,5,8,16]for(var i = n -1; i >=2;--i){if(c ==-1){
c = i;}elseif(d ==-1){
d = i;}if(c !=-1&& d !=-1){if(times[c]+ times[d]+(times[a]*2)>(times[b]*2)+ times[a]+ times[c]){
result +=(times[b]*2)+ times[a]+
times[c];}else{
result += times[c]+ times[d]+(times[a]*2);}
c =-1;
d =-1;}}if(c !=-1){result += times[a]+ times[b]+ times[c];}else{result += times[b];}
// Load HTTP moduleconst http =require("http");const hostname ="127.0.0.1";const port =8000;// Create HTTP serverconst 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('HelloWorld
');});// Prints a log once the server starts listening
server.listen(port, hostname,function(){console.log(`Server running at http://${hostname}:${port}/`);})
def print_all_numbers_then_all_pair_sums(numbers):
print "these are the numbers:"for number innumbers:
print number
print "and these are their sums:"for first_number innumbers:for second_number innumbers:
print first_number + second_number
// getting all required elementsconst 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 datalet 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 charsreturn data.toLocaleLowerCase().startsWith(userData.toLocaleLowerCase());});
emptyArray = emptyArray.map((data)=>{// passing return data inside li tagreturn data =`<li>${data}</li>`;});
searchWrapper.classList.add("active");//show autocomplete boxshowSuggestions(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}}functionselect(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");}functionshowSuggestions(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{functionloop()public{// for loopfor(uint i =0; i <10; i++){if(i ==3){// Skip to next iteration with continuecontinue;}if(i ==5){// Exit loop with breakbreak;}}// while loop
uint j;while(j <10){
j++;}}}
<!DOCTYPE html><html><body><h2>JavaScriptStatements</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 zdocument.getElementById("demo").innerHTML="The value of z is "+ z +".";</script></body></html>
{"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"}