zoukankan      html  css  js  c++  java
  • JavaScript Tutorial 01 #Basic#

     1 //object
     2     var book = {
     3         topic: "JavaScript",
     4         fat : true
     5     };
     6     book.topic = "CPP";
     7 
     8     //array
     9     var primes = [2,3,5,7];
    10     primes.length
    11 
    12     //
    13     var points = [
    14         {x:0, y:0},
    15         {x:1, y:1}
    16     ];
    17     var data = {
    18         trial1: [[1,2],[3,4]],
    19         trial2: [[2,3],[4,5]]
    20     };
    21 
    22     //function
    23     var square = function(x) {
    24         return x*x;
    25     };
    26     function plus1(x) {
    27         return x+1;
    28     }
    29 
    30     //object-oriented
    31     function Point(x,y) {
    32         this.x = x;
    33         this.y = y;
    34     }
    35     Point.prototype.r = function() {
    36         return Math.sqrt(this.x * this.x +this.y * this.y);
    37     };
    38 
    39     //types: primitive types and object type
    40 
    41     //
    42     var point = {x:1, y:1};
    43     "x" in point
    44     "z" in point
    45     "toString" in point
    46     //
    47     var d = new Date();
    48     d instanceof Date;
    49 
    50     typeof value == "string"
    51 
    52     //
    53     for(var p in o) {
    54         console.log(o[p]);
    55     }
    56 
    57     //
    58     with(document.forms[0]) {
    59         name.value = "";
    60         address.value = "";
    61     }
  • 相关阅读:
    WebServce之Map类型传输
    WebService之跨域
    WebServce之拦截器
    Webservice之发布
    JAVA之ElasticSearch
    MonogoDb学习笔记
    DotNetCore自带Ioc使用程序集名称注入
    生产者与消费者
    哈希算法-Time33
    线程安全的集合操作类
  • 原文地址:https://www.cnblogs.com/lambdatea/p/3376453.html
Copyright © 2011-2022 走看看