Wednesday, 10 May 2017

Data Types


<html>
<body>
<p id='demo1'></p>
<p id='demo2'></p>
<p id='demo3'></p>
<p id='demo4'></p>
<p id='demo5'></p>
<p id='demo6'></p>

<script>
var a=123e5;
document.getElementById('demo1').innerHTML=a+'it is the value of 123e5';

var b=123e-5;
document.getElementById('demo2').innerHTML=b +'it is the value of 123e-5';

var c=true
document.getElementById('demo3').innerHTML=c+'  this the boolean value c=true'


var car=[1,2,"bmw","vento"];
document.getElementById('demo4').innerHTML='  this is array 1st val   ' + car[0] +"<br>"+' this is sec val   '+car[3];


var person = {fn:'vishnu',ln:'falthoos',age:21};

document.getElementById('demo5').innerHTML=person.fn+'    this is the first object'+'<br><br>'+;


</script>
</body>
</html>

button click test size change

<!DOCTYPE html>
<html>

<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can change HTML content.</p>

<button type="button"
onclick="document.getElementById('demo').style.fontSize='35px'">
Click Me!
</button>

</body>
</html>

button click text change

<!DOCTYPE html>
<html>
<!-- <script src="https://www.w3schools.com/lib/w3.js"></script> -->
<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can change HTML content.</p>

<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>

</body>
</html>

Thursday, 4 May 2017

Image colour change

<html>

<title>colour change </title>

<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can change HTML content.</p>


<button  onclick="document.getElementById('myimage').src='C:/Users/abc/Documents/js/image/pic_bulboff.gif'">trun off</button>


<img id="myimage" src='C:/Users/abc/Documents/js/image/pic_bulboff.gif' style="width:200px">

<button  onclick="document.getElementById('myimage').src='C:/Users/abc/Documents/js/image/pic_bulbon.gif'">trun on</button>


</body>
</html>






REPL stands for Read Eval Print Loop

Starting REPL


$ node

$ node
>

Simple Expression


$ node
> 1 + 3
4
> 1 + ( 2 * 3 ) - 4
3
>

Use Variables

You can make use variables to store values and print later like any conventional script. If var keyword is not used, then the value is stored in the variable and printed. Whereas if var keyword is used, then the value is stored but not printed. You can print variables using console.log().
$ node
> x = 10
10
> var y = 10
undefined
> x + y
20
> console.log("Hello World")
Hello Workd
undefined

Multiline Expression

$ node
> var x = 0
undefined
> do {
... x++;
... console.log("x: " + x);
... } while ( x < 5 );
x: 1
x: 2
x: 3
x: 4
x: 5
undefined
>
... comes automatically when you press Enter after the opening bracket. Node automatically checks the continuity of expressions.

Underscore Variable

You can use underscore (_) to get the last result −
$ node
> var x = 10
undefined
> var y = 20
undefined
> x + y
30
> var sum = _
undefined
> console.log(sum)
30
undefined
>

REPL Commands

  • ctrl + c − terminate the current command.
  • ctrl + c twice − terminate the Node REPL.
  • ctrl + d − terminate the Node REPL.
  • Up/Down Keys − see command history and modify previous commands.
  • tab Keys − list of current commands.
  • .help − list of all commands.
  • .break − exit from multiline expression.
  • .clear − exit from multiline expression.
  • .save filename − save the current Node REPL session to a file.
  • .load filename − load file content in current Node REPL session.

Stopping REPL.


$ node
>
(^C again to quit)
>

Tuesday, 18 April 2017

Accelerated Mobile Pages

https://moz.com/blog/accelerated-mobile-pages-whiteboard-friday

Monday, 3 April 2017

One Life

After birth, it should be possible, technically, theoritically and actually, to achieve the goal of your human life in one life – that life. My Guruji used to say, "We should not have to take birth as a human being more than once." Because if we stick faithfully to the parameters of our own evolutionary path that we have outlined for ourselves, the program we have written uniquely, each one for himself or herself, nothing can stop it.