23 Kasım 2015 Pazartesi

JavaScript appendChild Property Kullanımı


window.onload = function(){
   
    var p3 = document.createElement("p");
    var text3 = document.createTextNode("text3 here! ");
    var text4 = document.createTextNode("text4 here! ");
    p3.appendChild(text3);
    p3.appendChild(text4);
    var div3 = document.getElementById("div1");
    div3.appendChild(p3);
   
}

/* text elementleri:  p elementi içine katıldı*/
/* p elementleri ise: div elementi içine atıldı. */

How old are you?


var promptName = prompt("Whats your Name?");
var promptAge = prompt("How old are you?");

function person(){
    this.name = promptName;
    this.age = promptAge;
    this.birth = gelenYear;
}

function gelenYear(){
    return 2016 - this.age;
}

var p1 = new person();

document.write("Your name is " + p1.name + " and your birth year is " 

20 Kasım 2015 Cuma

Overloading a Method

Method Overloading means that you are using couple of methods that has the same name: but different parameters (thats the important part of Overloading: same Methods, different Parameters).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace New
{
    class Program
    {
        static void Main()
        {
            Console.WriteLine("You are in Main Method.");
            Console.WriteLine("---");
            Enter(5);
            Console.WriteLine("---");
            Enter(5.2);
        }
       
        static void Enter(int n)
        {
            Console.WriteLine("You are in Enter Method with INT parameter");
            Console.WriteLine(n);
        }
       
        static void Enter(double n)
        {
            Console.WriteLine("You are in Enter Method with DOUBLE parameter");
            Console.WriteLine(n);
        }
    }
}