Javascript

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.

Subjects

Latest Asked Question

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);
45 Likes
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.
45 Likes
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.
45 Likes
A : Hi you can use this. document.querySelector('#click').click();TV Tested.
45 Likes
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');
45 Likes
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; } }
45 Likes
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) }); }); });
45 Likes
A : use the following code to create canvas object in html using javascript <canvas id="myCanvas" width="200" height="100" style="border:1px solid #c3c3c3;"></canvas> javascript is here:- var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); ctx.fillStyle = "#FF0000"; ctx.fillRect(0,0,150,75);  
45 Likes
A : var str = "High thinking simple living";  var res = str.match(/ing/g); console.log(res); Output: ing,ing
45 Likes
A : <script> function confirmAlert(){ var x = confirm("Are you sure to submit this form."); if(x){ /* write your code here that you want to perform*/ } } </script>
45 Likes
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"
45 Likes
A : Here is the code. <body>   <input type='file' onchange="showImg(this);" />     <img id="blah" src="#" alt="your image" /> </body> <script> function showImg(input) {         if (input.files && input.files[0]) {             var reader = new FileReader();             reader.onload = function (e) {                 $('#blah')                     .attr('src', e.target.result)                     .width(150)                     .height(200);             };             reader.readAsDataURL(input.files[0]);         }     } </script>
45 Likes
Javascript Related Topic's