日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
JavaScript的兩大類內(nèi)建數(shù)據(jù)類型

 JavaScript的數(shù)據(jù)類型在大的方向上分為兩類:1)primitive types and 2)object tyeps。

創(chuàng)新互聯(lián)公司的客戶來自各行各業(yè),為了共同目標,我們在工作上密切配合,從創(chuàng)業(yè)型小企業(yè)到企事業(yè)單位,感謝他們對我們的要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。專業(yè)領(lǐng)域包括成都網(wǎng)站設(shè)計、網(wǎng)站制作、電商網(wǎng)站開發(fā)、微信營銷、系統(tǒng)平臺開發(fā)。

其一 primitive types包括常規(guī)的 numbers,string, booleans 以及特殊類型的 null 和 undefined。而且以上五類都是immutuable types;

其二,object types 包括object,以及特殊類型的object即array。其他比如 Set,Map,typed array, RegExp and Date types.

一、Numbers

Numeric literal 表示 十六進制,二進制和八進制:

 
 
 
  1. //integer literals 
  2. > 0xff 
  3. 255 
  4. > 0b1011 
  5. 11 
  6. > 0o377 
  7. 255 
  8. > 377 
  9. 377 
  10. //floating-point literals 
  11. undefined 
  12. > 6.02e23 
  13. 6.02e+23 
  14. > 1.47e-23 
  15. 1.47e-23 
  16. //Arithmetic  
  17. Math.hypo 
  18.  
  19. //Infinity 
  20. Infinity                    // A positive number too big to represent 
  21. Number.POSITIVE_INFINITY    // Same value 
  22. 1/0                         // => Infinity 
  23. Number.MAX_VALUE * 2        // => Infinity; overflow 
  24.  
  25. -Infinity                   // A negative number too big to represent 
  26. Number.NEGATIVE_INFINITY    // The same value 
  27. -1/0                        // => -Infinity 
  28. -Number.MAX_VALUE * 2       // => -Infinity 
  29.  
  30. NaN                         // The not-a-number value 
  31. Number.NaN                  // The same value, written another way 
  32. 0/0                         // => NaN 
  33. Infinity/Infinity           // => NaN 
  34.  
  35. Number.MIN_VALUE/2          // => 0: underflow 
  36. -Number.MIN_VALUE/2         // => -0: negative zero 
  37. -1/Infinity                 // -> -0: also negative 0 
  38. -0 
  39.  
  40. // The following Number properties are defined in ES6 
  41. Number.parseInt()       // Same as the global parseInt() function 
  42. Number.parseFloat()     // Same as the global parseFloat() function 
  43. Number.isNaN(x)         // Is x the NaN value? 
  44. Number.isFinite(x)      // Is x a number and finite? 
  45. Number.isInteger(x)     // Is x an integer? 
  46. Number.isSafeInteger(x) // Is x an integer -(2**53) < x < 2**53? 
  47. Number.MIN_SAFE_INTEGER // => -(2**53 - 1) 
  48. Number.MAX_SAFE_INTEGER // => 2**53 - 1 
  49. Number.EPSILON          // => 2**-52: smallest difference between numbers 
  50. // 浮點數(shù)  
  51. 18,437,736,874,454,810,627 只有這么多浮點數(shù),能被表示出來。 
  52. // rouding problems  
  53. //BigInt 
  54.  
  55. //Date and time 
  56. let timestamp = Date.now();  // The current time as a timestamp (a number). 
  57. let now = new Date();        // The current time as a Date object. 
  58. let ms = now.getTime();      // Convert to a millisecond timestamp. 
  59. let iso = now.toISOString(); // Convert to a string in standard format. 

 二、String and Text

 
 
 
  1. // 1.string literals 
  2. // 2.escape sequences  
  3. // 3.string methods 
  4. // 4.template literals (tagged template literals) 
  5. // 5.Pattern Matching  
  6. /[1-9][0-9]*/;  

 三、Boolean Values

只有 true 和 false 這兩項。

四、null and undefined

 
 
 
  1. > typeof(null) 
  2. 'object' 

 五、Symbols

 
 
 
  1. let s = Symbol.for("shared"); 
  2. let t = Symbol.for("shared"); 
  3. s === t          // => true 
  4. s.toString()     // => "Symbol(shared)" 
  5. Symbol.keyFor(t) // => "shared" 

 六、Global

  • Global constants like undefined, Infinity, and NaN
  • Global functions like isNaN(), parseInt() (§3.9.2), and eval() (§4.12)
  • Constructor functions like Date(), RegExp(), String(), Object(), and Array() (§3.9.2)
  • Global objects like Math and JSON (§6.8)

七、Immutable Primitives and Mutable Object Referece

 
 
 
  1. > function equalArray(a, b) { 
  2. ... if (a === b) return true; 
  3. ... if (a.length !== b.length) return false; 
  4. ... for (let i = 0; i < a.length; i++) { 
  5. ..... if (a[i] !== b[i]) return false; 
  6. ..... } 
  7. ... return true; 
  8. ... } 

 八、Type Conversions

implicite conversion and explicite conversions

九、Variable Declaration and Assignment

 
 
 
  1. // Destructuring Assignment 
  2. [x,y] = [x+1,y+1];  // Same as x = x + 1, y = y + 1 
  3. [x,y] = [y,x];      // Swap the value of the two variables 
  4. // Same as const sin=Math.sin, cos=Math.cos, tan=Math.tan 
  5. const {sin, cos, tan} = Math; 
  6. //此處與python的用法完全一致。 

 【編輯推薦】

  1. 2021年比較適合用于Web開發(fā)的7種編程語言
  2. 為什么用Eclipse,VS Code不香嗎?
  3. 權(quán)威數(shù)據(jù)來了,中國到底有多少個程序員?
  4. 10個實用的工具類網(wǎng)站你收藏了嗎?
  5. 在2021年,可能會是前景比較好的五門編程語言

新聞名稱:JavaScript的兩大類內(nèi)建數(shù)據(jù)類型
網(wǎng)站網(wǎng)址:http://m.5511xx.com/article/djcesih.html