屬性擴充套件及函式簡單複習

2022-09-06 08:54:07 字數 456 閱讀 5543

利用的是私有變數可以有多個屬性,也可以返回任意值型別,從而將自己所需要的值型別利用函式方法寫出來達到自己的目的。

例://nxinxi類

public class nxinxi

set

}private string _nplace;

public string nplace

set

}public string nationplace

}//nxinxidata類

public class nxinxidata

public string select(string ncd)

conn.close();

return end;}}

1、有參有反

public 資料型別 函式名(資料型別 引數名)

2、有參無反

public void 函式名(資料型別 引數名)

函式的擴充套件 name屬性

函式的name屬性返回該函式的函式名 function foo foo.name foo 這個屬性早就被瀏覽器廣泛支援,但是直到 es6,才將其寫入了標準。需要注意的是,es6 對這個屬性的行為做出了一些修改。如果將乙個匿名函式賦值給乙個變數,es5 的name屬性,會返回空字串,而 es6 的na...

函式的擴充套件 簡單

es6可以為函式指定預設值 function log x,y world log hello hello world log hello china hello china log hello hello函式的length屬性 指定了預設值以後,函式的 length 屬性,將返回沒有指定預設值的引數...

oracle 複習體系二 系統簡單函式

轉換大寫 connect scott tiger select upper ename from emp 小寫 select lower ename from emp 計算長度 select from emp where length ename 5 substr context,begin,len...