Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>JS Bin</title>
- </head>
- <body>
- <input type = "button" value="zadanie"
- onclick="Zadanie1(array,array2,tablicFun);">
- <input type = "button" value="zadanie2"
- onclick="Zadanie2(array,array2,laczwwspolrzedne);">
- <input type = "button" value="zadanie3" onclick="zadanie4(3,5);">
- <input type = "button" value="zadanie4" onclick="zad6();">
- </body>
- </html>
- <script>
- var array=[4, 5, 6];
- var array2=[10, 20, 30];
- function Zadanie1(ar,ar2,z)
- {
- z(ar,ar2);
- }
- function tablicFun(ar,ar2)
- {
- for(i=0;i<array.length;i++)
- {
- document.write(array[i]+array2[i]+"<br>");
- }
- }
- function Zadanie2(ar,ar2,z)
- {
- var zew = new Array(ar.length);
- zew=z(ar,ar2);
- for(i=0;i<zew.length;i++)
- {
- document.write(zew[i].x+":"+zew[i].y+"<br>");
- }
- }
- function laczwwspolrzedne(ar,ar2)
- {
- var objt = new Array(ar.length);
- for(i=0;i<ar.length;i++)
- {
- objt.x = ar[i];
- objt.y = ar2[i];
- document.write(objt.x+":"+objt.y+"<br>");
- }
- return objt;
- }
- function zadanie4(p,e)
- {
- for(i=p;i<=e+1;i++)
- {
- document.write(second()+"<br>");
- }
- function second()
- {
- if(i>e)
- {
- return number.NaN;
- }
- return i;
- }
- }
- function zad6()
- {
- var objekt = new Objekt();
- objekt.isExist(1);
- }
- function Objekt()
- {
- this.Liczby = [4, 5, 6];
- this.Show = function()
- {
- for(i=0;i<this.Liczby.length;i++)
- {
- document.write(this.Liczby[i]+"<br>");
- }
- }
- this.Remove = function (id)
- {
- this.Liczby.splice(id,1);
- return 0;
- }
- this.isExist = function (a)
- {
- for(i=0;i<this.Liczby.length;i++)
- {
- if(this.Liczby[i]==a)
- {
- document.write(a+" znajdeuje sie w tablicy");
- return 1;
- }
- }
- document.write(a+" nieznajduje sie w tablicy");
- return 0;
- }
- this.Add = function (a)
- {
- if(this.Liczby[this.Liczby.length]!=a)
- {
- this.Liczby.push(a);
- }
- return 0;
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement