Posts

Showing posts from September, 2016

how to call javascript function automatically after some time

<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var file = ["a","b","c","d"]; var myTimer; var j = 0; myTimer = setInterval(function() { alert('hi'); j++; for(var i = 0; i < 5; i++) { alert('i= '+i); } alert(j+'and'+file[j]); if(file[j] == 'c'){ clearInterval( myTimer ); } }, 1000); } </script> </body> </html>

how to use system cmd in javascript

Image
hii firstly open terminal and install shelljs  $ npm install shelljs $ touch file.js $ nano file.js and type code in file.js var shell = require('shelljs'); shell.echo('hello world'); and save and run the file on terminal $ node file.js

how to use system cmd in javascript

Image
hii firstly open terminal and install shelljs  $ npm install shelljs $ touch file.js $ nano file.js and type code in file.js var shell = require('shelljs'); shell.echo('hello world'); and save and run the file on terminal $ node file.js