File: example.js

Recommend this page to a friend!
  Classes of Chi H.   Book list   example.js   Download  
File: example.js
Role: Example script
Content type: text/plain
Description: example.js
Class: Book list
Display and sort a book list
Author: By
Last change:
Date: 7 years ago
Size: 747 bytes
 

Contents

Class file image Download
/* * Copyright (C) Chi Hoang - All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * For educational purpose only * Written by Chi Hoang March 2016 * */ window.onload = function ready () { l = new Publisher(new List()); for (var i=0;i<10;i++) { l.AddAuthor(new Subject(100),i,i%2); } var t = new Date().getDate() + (6 - new Date().getDay() - 1) - 7 ; var d = new Date(); d.setDate(t); lastFriday = (('0' + (d.getDate())).slice(-2) + '.' + ('0' + (d.getMonth() + 1)).slice(-2) + '.' + d.getFullYear()); console.log(lastFriday); for (var i=0;i<200;i++) { l.AddBook(new Subject(100), "name_"+i%10,i%10,i%3,(i%3==0 ? lastFriday : 0)); } console.log(l.observers); }