Skip to content

Instantly share code, notes, and snippets.

View css.css
.container {
width: 500px;
background: #0099ff;
margin: 0 auto;
}
.container .item {
background: #00ffa2;
color: #d32a2a;
text-align: center;
font-size: 36px;
View javascript.js
# serve with hot reload at localhost:8080
npm run dev //這是開發版環境
# build for production with minification
npm run build //這是正式版環境
View index.js
var name = 'ken';
if ( name === 'ken'){
 alert('hi ken')
}
View index.js
var name = 'bob';
if ( name === 'ken'){
 alert('hi ken')
} else { 
 alert(" I don't know you")
}
View index.js
var name = 'bob';
if ( name === 'ken'){
 alert('hi ken')
} else if (name === 'bob' ) { 
 alert(" hi bob")
} else {
 alert(" I don't know you")
}
View index.js
var name = 'bob';
if ( name === 'ken' || name === 'bob'){
 alert('hi ken or bob')
}
else {
alert(" I don't know you")
}
View index.js
var name = 'bob';
if ( name === 'ken' && name === 'bob'){
 alert('hi ken or bob')
}
View index.js
if ( firstName === 'ken' && secondName === 'bob'){
 alert('hi ken or bob')
}
var firstName = 'ken';
var secondName = 'bob';
View index.js
var name = 'ken';
if (!(name === 'bob')){
 alert('hi bob')
}
View index.js
var myName = '驚不驚喜';
function callName() {
 console.log(this,this.myName);
}
var family = {
 myName: '老王',
 callName: callName
}
family.callName();
You can’t perform that action at this time.