JavaScript: Data Structures

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// JavaScript Document 
// file:1.js
// edit: geovindu, Geovin Du
/*var GeovinDu = {
   firstName: "Geovin",
   lastName: "Du"
};
 
var student1 = {
   id: "12345678",
   courses: ["Programming I", "English II", "Chinese"],
   advised: false
};
 
console.log(GeovinDu.lastName); // displays "Du"
console.log(student1["id"]); // displays "12345678"
console.log(student1.courses[1]); displays "English II"
student1.advised = true;
GeovinDu.age = 50;*/
$(document).ready(function () {
     
function Person(first, middle, last) {
   this.first = first;
   this.middle = middle;
   this.last = last;
   this.initials = initials;
}
     
function CNPerson(sumname, realname, age,sex) {
   this.sumname = sumname;
   this.realname = realname;
   this.age = age;
   this.sex=sex;
   this.gender = gender;
}
 
     
function gender()
{
        //暂时,以一个处理,不以数组处理
        var cn="";
        if(this.age>=18 && this.sex=="女")
        {
            cn="小姐";
        }
        if(this.age>=30 && this.sex=="女")
        {
            cn= "女士";
        }
        if(this.age>=18 && this.sex=="男")
        {
            cn= "先生";
        }
        if(this.age>=30 && this.sex=="男")
        {
            cn="先生";
        }
    return cn;
}
     
function initials() {
   //取第一个字母
   return this.first[0] + this.middle[0] + this.last[0];
}
 
var aPerson = new Person("Du","King","Geovin");
console.log("First name: " + aPerson.first);
console.log("Middle name: " + aPerson.middle);
console.log("Last name: " + aPerson.last);
console.log("Initials: " + aPerson.initials());
     
     
var cPerson=new CNPerson("涂","聚文",25,"男");
console.log("姓:"+cPerson.sumname);
console.log("名:"+cPerson.realname);
console.log("年龄:"+cPerson.age);
console.log("性别:"+cPerson.sex);
//cPerson.gender=gender();
//console.log(cPerson.gender);
console.log("称呼:"+cPerson.gender())
     
$("#sumname").html(cPerson.sumname);
$("#realname").html(cPerson.realname);
$("#age").html(cPerson.age);
$("#sex").html(cPerson.sex);
$("#gender").html(cPerson.gender());   
});
    

  

 

调用:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Data Structures & Algorithms with JavaScript </title>
    <meta name="Description" content="geovindu,涂聚文,Geovin Du"/>
<meta name="Keywords" content="geovindu,涂聚文,Geovin Du"/>
<meta name="author" content="geovindu,涂聚文,Geovin Du"/>   
<script  src="js/jquery-3.6.0.js"></script>
<script type="text/javascript" src="data/1.js"></script>   
</head>
 
<body>
<div id="sumname">du</div>
<div id="realname">geovin</div>
<div id="age"></div>
<div id="sex"></div>
<div id="gender"></div>
 
</body>
</html>

  

 

 

Agile Principles, Patterns, and Practices in C#

https://github.com/aclimarin/AgilePrinciplesPatternsAndPractices
https://github.com/donaldnevermore/agile-principles

Java
https://github.com/kwon37xi/AgileSoftwareDevelopmentPrinciplesPatternsAndPractices
https://github.com/oneils/agile-principles-example


Data Structures & Algorithms with JavaScript
by Michael McMillan
https://www.oreilly.com/library/view/data-structures-and/9781449373931/
https://github.com/oreillymedia/data_structures_and_algorithms_using_javascript

Learning JavaScript Data Structures and Algorithms, Third Editon
https://github.com/PacktPublishing/Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition
https://www.oreilly.com/library/view/learning-javascript-data/9781788623872/

C Programming: A Modern Approach 2and Edition
by K.N.King
https://github.com/fordea/c-programming-a-modern-approach
https://www.wiley.com/en-au/C+Programming%3A+A+Modern+Approach%2C+2nd+Edition-p-9780393979503
https://www.ituring.com.cn/book/2947
https://www.ituring.com.cn/book/2947

 

posted @   ®Geovin Du Dream Park™  阅读(9)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
历史上的今天:
2022-09-29 CSharp: Iterator Pattern
2011-09-29 csharp datagridview to a datatable,a dataset
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示