Monday, 11 January 2016

var Datatype Use in Javascript Using Asp.Net

var Datatype Use in Javascript

Var Datatype use to multiple  like int,string  also accepted  but once create var a = 10  after that does't accept another  like var a="dotnet".



var a = "50";
        var b = 10;
        var c = a - b;
        alert("Subtraction= "+ c);

output

var a = "50";
        var b = 10;
        var c = parseInt(a) + b;
        alert("Addition = " + c);

output

                         

var a = "50";
        var b = 10;
        var c = a + b;
        alert("Addition = " + c);

output
                                    

var a = "Dotnet";
        var b = "Drizzles"
        var c = a + b;
        alert(c);

 output
             
   var a = 9.98;
        var b = 0.02;
        var c = a + b;
        alert (c); 
   
output
                       

HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>var Datatype Use in Javascript Using Asp.Net</title>
    <script type="text/javascript">


        var a = "50";
        var b = 10;
        var c = a - b;
        alert("Subtraction= "+ c);

        var a = "50";
        var b = 10;
        var c = parseInt(a) + b;
        alert("Addition = " + c);

  var a = "50";
        var b = 10;
        var c = a + b;
        alert("Addition = " + c);

var a = "Dotnet";
        var b = "Drizzles"
        var c = a + b;
        alert(c);

var a = 9.98;
        var b = 0.02;
        var c = a + b;
        alert (c);

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>



</html>

0 comments:

Post a Comment