Saturday, 29 June 2013

how to understand for loops in javascript

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
-----------------------------------------------------------------------------------------------------------
Few days back in summer we went to beach, I have collected few pebbles. I called my daughter given pebbles one by one.


I have given first one-1 pebble
She started counting 1pebb
Next given second one-1 pebb
She started counting 1+1 pebb=2 pebbles
Next given third one-1 pebb
She started counting 2+1 pebb=3 pebbles
Next given fourth one-1 pebb
She started counting 3+1=4 pebbles


This is foundation for FOR loop to understand.


var daughter;

for(daughter=1;daughter<=4;daughter++)
{
document.write(daughter);
}


how to understand program

var daughter:DECLARATION

DAUGHTER<=4 : FATHER IS CONDITION ,BECAUSE HE KNOWS HOW MANY PEBBLES IN HIS HAND.

DAUGHTER IS COUNTING: DAUGHTER++

var daughter;

for(daughter=1;daughter<=4;daughter++)
{
document.write(daughter);
}

for loop iteration:
first iteration  1 number->Because i have given 1 pebble-she started counting 1 pebble

second iteration 2 number->i have given another 1 pebble-she started counting 1+1=2 or[daughter++=2]

third iteration 3 number-> i have given another 1 pebble-she started counting 2+1=3 or[daughter++=3]

fourth iteration 4 number->i have given another 1 pebble-she started counting 3+1=4 or[daughter++=4]

------------------------------------------------------------------------------------------------------------
Next you can implement above methodology in your environment(c,c++,c#,java)






                 

Friday, 28 June 2013

how to understand if and else


Authour:I will teach you courses online
C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
How to understand IF and Else:

Programming means a programmer expect some scenarios, in user perspective.
Based on that we develop program-mes. Don't think it's very hard.

See below explanation-A simple way to explain if and else

Today you decided to go your hometown, Assume that sometimes it will happen. While riding bike you have decided IF i luckily catch the train it's ok ELSE it's better to go by BUS. You rushed to railways station, you were all ready late. Then already option chosen by you that is BUS.

So real world you are a big programmer, I am right.

See this

if (train==their)

{
alert("Travel by train")

}

else

{
alert("Travel By BUS");

}


Niece explanation isn’t it. Again don't add my in your fans list.

If(i==5)
{
alert(“Target reached”);
}
Else
{
  Alert(“Try again”);


}

Very Simple.


Take my knowledge and improve yourself.

if and else

if(a==1)
{
alert("Yes a 1");
a=0;
}
else
{
alert("Some other value: " + a);
}

By reading above explanation you can easily understand this.

Next how to understand multiple if and else 






.
.

Monday, 24 June 2013

Thanks to Readers



Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Dear Readers,



Becz of Readers our blog reach the sky by hitting  the floor. I am very much happy because my unique content is selected by bing.com [Microsoft].

Microsoft Gives me a great place in society, Future I will work for you very hard (clever)

I will appear with new innovative thoughts. Like below




Once again thank you to all people, who are watching my blogs.

See results :1020000- Out of 1020000 we came first.

























Milestone today:on 25 th of 6 2013 out of 1040000 results we came first
Milestone today:on 27 th of 6 2013 out of 1040000 results we came first

Created sensational today out of 1060000 RESULTS we came first today, Eventhough Results increased[Adding new websites] we came FIRST, 

 DAYONE OUTOF 1020000: WE CAME FIRST
 NEXT ON 25TH OUTOF 1040000:WE CAME FIRST
 TODAY ON 28TH OUTOF 1060000:WE CAME FIRST, Enjoy  GLORIOUS VICTORY.
HIP HIP HURRAY HURRAY

Again and again TODAY ON 29TH OUTOF 1060000:WE CAME FIRST, FEELING IS ENDLESS
THANK YOU TO ALL  


On 01/July/2013 stats saying that we are top of world, Enjoy glorious victory
Our success is endless. Proud to say we are top of world out of 1060000 websites
Thank you to all.

on 7/2/2013
Thanks to readers  becz of you today our blog became popular in any search engine you can found our blog any where, Thanks to Microsoft selecting my unique code. Still we are top of world.

 







Thursday, 13 June 2013

Introducing Objects



Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Objects r two types

DOM objects and Built-in objects, We have all ready see about Date dom objects in previous chapters, If not click on below link.


Although JavaScript’s variables and arrays are most convenient to store data. Sometimes you need big database. Like business card database, because every business card contains names, phone numbers, Addresses.


With objects, you can make the variables that store the db [database] as logical as business cards. Each person identified by a Card object which has properties for name, address and phone number.

How to Define an object:
You know that each object has certain methods and properties.

First we need to create object and then properties.

Object name is :Card

and properties are 

>>NAME
>>ADDRESS
>>MOBILE PHONE
>>HOUSE PHONE

To genrate number of objects in javascript is to create a function to make new card objects. This function is called constructor in javascript 
   
function Card(name,address,work,home){

this.name=name;
this.address=address;
this.workphone=work;
this.homephone=home;
}

Next print output like this.Let's create a function

function PrintCard()  {

line1="Name: " + this.name + "<BR>";
line2="Address:" + this.address + "<BR>";
line3="Workphone:" + this.workphone + "<BR>";
line4="Homephone:" + this.homephone +"<BR>";
document.write(line1,line2,line3,line4);
}

Above function will read the properties from current object by THIS and assign to
line1,line2,line3,line4

output with document.write(line1,line2,line3,line4)

Creating an Object Instance:

shrinivas=new Card("Vas shrinivas","new Avenue street","80987000000000","090000000" );

Now Card function is called, Assigned these parameters in to variables of Card function. And you created shrinivas object.

You did everything at a time, Above code you can write like this

1).Line-------------------------->shrinivas=new Card();
2).Line--------------------------->shrinivas.

Now if you write shrinivas. After you put (DOT after shrinivas) you will see all properties of Card function, they are name, address, work, home.

shrinivas=new Card();
shrinivas.name="Vas.Shrinivas";
shrinivas.address="new Avenue street";
shrinivas.work="80987000000000";
shrinivas.home="090000000";

Now this time to print everything

shrinivas.PrintCard();

Extending Built-in Objects

It's like extend power of objects, Means adding new features to it.

How?

For example, if u thinks the String object doesn't fit for our needs, we can extend it. 

title="Shrinivas welcomes you";

document.write(title.heading(1));

Example:
<html>
<head><title>Test of headings </title>
</head>

<body>

<script type="text/javascript">

function addhead (level) {

html="H" + level;

text=this.toString();

start="<" + html + ">";

stop="</" + html + ">";

return start + text + stop;

}

String.prototype.heading=addhead;

document.write("This is a heading 1" .heading(1));
document.write("This is a heading 2" .heading(2));
document.write("This is a heading 3" .heading(3));

</script>
</body>

</html>