Skip to content

Instantly share code, notes, and snippets.

@bmoren
Created April 28, 2016 19:29
Show Gist options
  • Save bmoren/e72287a3a9e4ce18dd260ef27fe0bcdb to your computer and use it in GitHub Desktop.
Save bmoren/e72287a3a9e4ce18dd260ef27fe0bcdb to your computer and use it in GitHub Desktop.
Js/Jq basics
$(function(){
console.log("jquery is good!")
// //+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+Datatypes_~+~+~+~+~+~+~+~+~+~+~+~+
// //strings
// "string"
// 'string'
//
// 'the quick brown fox jumped over a log'
//
// //integers aka. int
// 8
// 0192830981203812309812309
// 74
//
// //floats, decimal place #s
// 3.14
// 8.901823908129083120813
// 902309123821093823.12098309128309128093
// .54908209482304823048230948230948230948230948230948230948230942309482139489149014023140283408723085723087230874028347028347082374082374082374082734087230487230487230847230847230847230847203847082347082374082374087230487230847203874082374082374082374082734087234087230487230472038470234708237408237408723408723048720487230847230847230847028374082374082374082374082340872304872308234087234087230487230847230847230487230487230487230847230874082734082374082374082374082340873240872340872308237408234723084230874230874082340723048723084230840782344
//
// //boolean true / false : binary relationship, on/off, 0/1
// true
// false
//
//~_~_~_~_~_~_~_~_~_~_~_ variables +~+~+~+~+~+~+~+~+~+~+~+~+~+
// variables are containers for information
//
// var coolstuff = 99999999999;
//
// coolstuff = "this is the cool stuff";
//
// console.log(coolstuff);
// +!+!+!+!+!+!+!++!+!+!+!+!+ concat strings +!+!+!+!+!+!+!+
// var coolstuff = "image/" + 6 + ".jpg";
// console.log(coolstuff);
// $('body').click(function(){
// // +!+!+!+!+!+!+!+ Random Numbers ~+~+~+~+~+~+~+~+~+~+
// //and putting them to use!
//
// var diceThrow = Math.floor( Math.random() * 6 +1 );
// console.log(diceThrow);
//
// var coolstuff = "image/" + diceThrow + ".jpg";
// console.log(coolstuff);
//
// $('img').attr('src', coolstuff);
//
// }); // closes the 'body' click handler
//
//+~+~+~+~+~+~+~ IF/THEN - Logic Statements
// if(SOME condition is met){
// // do all of the the things in here
// }
// var diceThrow = Math.floor( Math.random() * 6 +1 );
// console.log(diceThrow);
//
// if(diceThrow == 5){
// console.log("FIVE FIVE FIVE IS THE BEST, SIX HAS GOT NOTHING ON FIVE!");
// }
//
// if(diceThrow < 6){
// console.log('WE ARE SMLL, 6 is the king');
// // console.log(" NO WAY I'm the best! SIX IS THE BEST!");
// }
//
//what is console.log good for anyway?
// $('body').click(function(event){
// console.log(event);
// })
}); //end jquery init
// datatypes
// concat stings
// variables
// random
// logic
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
img{
width:800px;
}
</style>
</head>
<body>
<img src="image/1.jpg">
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<script src="app.js" charset="utf-8"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment