JavaScript is the programming language of HTML and the Web.
JavaScript is easy to learn.
Web pages are not the only place where JavaScript is used. Many desktop and server programs use JavaScript. Node.js is the best known. Some databases, like MongoDB and CouchDB, also use JavaScript as their programming language.
JavaScript was invented by Brendan Eich in 1995, and became an ECMA standard in 1997.
ECMA-262 is the official name of the standard. ECMAScript is the official name of the language.
A :
this your solution use indexOf() and array.splice() method in javascript.
var array = [2, 5, 9];
console.log(array);
var index = array.indexOf(5);
if (index > -1) {
array.splice(index, 1);
}
// array = [2, 9]
alert(array);
A :
You can solve your query using reduce() method in javascript
Use the JavaScript reduce() Method
var array1 = [95, 782, 523, 474];
var array2 = [55, 12, 50];
// Getting sum of numbers of aray1.
var sum1 = array. reduce(function(a, b){
return a + b;
}, 0);
// Getting sum of numbers of aray2.
var sum2 = array2. reduce(function(a, b){
return a + b;
}, 0);
console. log(sum1 + sum2); // Prints: 1991.
A :
hi you can try
var x = [{"hello":"1", "hello2":"456"}];
var y = [{"hi1":"852", "hi2":"9632", "hi3":"75391}];
Array.prototype.push.apply(x,y);
console.log(x);
//x will print combined array;
workable and tested.
A :
Hi you can use this.
document.querySelector('#click').click();TV
Tested.
A :
function ChangeUrl(page, url) {
if (typeof (history.pushState) != "undefined") {
var obj = {Page: page, Url: url};
history.pushState(obj, obj.Page, obj.Url);
} else {
alert("Browser does not support HTML5.");
}
}
ChangeUrl('Page1', ''loading.php');
A :
Hey you can use it also.
setTimeout(start, 1000);
var i = 1;
var num = document.getElementById("number");
function start() {
setInterval(increase, 1000);
}
function increase() {
if (i < 100) {
i++;
num.innerText = i;
}
}
A :
hi using jquery fast
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
A :
use the following code to create canvas object in html using javascript
javascript is here:-
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,150,75);
A :
var str = "High thinking simple living";
var res = str.match(/ing/g);
console.log(res);
Output:
ing,ing
A :
function confirmAlert(){
var x = confirm("Are you sure to submit this form.");
if(x){
/* write your code here that you want to perform*/
}
}
A :
Use follow code in javascript to disable button
document.getElementById("submitnewquestion").disabled = true;
if you want enable button use
document.getElementById("submitnewquestion").disabled = false;
Note : button type="submit"