Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<meta charset="utf-8">
<title>The Slide</title>
<link rel="stylesheet" href="./dist/talkie.min.css">
<link rel="stylesheet" href="./dist/talkie-default.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/monokai_sublime.min.css">
</head>
<body>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Velocityを使ってみる</title>
</head>
<style>
img{position:fixed;width:400px;z-index: 3;}
div {position:fixed;width:400px;opacity: 0.7;}
#veloBase1 {
The MIT License (MIT)
Copyright (c) [2015] [chuck]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
//Spread operator
//配列の前に...をつけることで展開できる。
var arr = [3, 4, 5];
var nums = [1, 2, ...arr, 6, ...[7]];
console.log(nums);
//[1, 2, 3, 4, 5, 6, 7]
//[3,4,5]と[7]が展開されている
//applyメソッドを使用しなくても良い。
function f(x, y, z) {
//Spread operator
//配列の前に...をつけることで展開できる。
var arr = [3, 4, 5];
var nums = [1, 2, ...arr, 6, ...[7]];
console.log(nums);
//[1, 2, 3, 4, 5, 6, 7]
//[3,4,5]と[7]が展開されている
//applyメソッドを使用しなくても良い。
function f(x, y, z) {
//Enhanced object literals
//変数名と同じキーや無名関数のfunctionを省略できる
var name = 'chuck', age = '24';
//ES5
var person = {
name : name,
age : age,
hi : function() {return 'hi';}
};
//Enhanced object literals
//変数名と同じキーや無名関数のfunctionを省略できる
var name = 'chuck', age = '24';
//ES5
var person = {
name : name,
age : age,
hi : function() {return 'hi';}
};
//Destructuring
var [a, , b] = [1, 2, 3];
console.log(a, b);
function today() { return {y: 2015, m: 4, d: 25}; }
var {y: year, m: month} = today();
console.log(year, month);
//関数の引数にも使える
function dest({name: name}) {
//Destructuring
var [a, , b] = [1, 2, 3];
console.log(a, b);
function today() { return {y: 2015, m: 4, d: 25}; }
var {y: year, m: month} = today();
console.log(year, month);
//関数の引数にも使える
function dest({name: name}) {
//今までコンストラクタ関数とprototypeを使用して表現してきた
//クラス構造を、クラス用の構文で定義できる。
//ES5
var Person = function(name) {
this.name = name;
};
Person.prototype.hi = function() {
return 'hi, my name is ${this.name}';
};