JSFiddle - React, Tailwind, and code Playground

by markrummel

JavaScript

//Movie #1
var movieID = 55555;
var stay = 'yes';

var votes = {};
votes[movieID]={};
votes[movieID].stay = stay;

var scenes = 1;
votes[movieID].scenes = scenes; 
var outtakes = 0;
votes[movieID].outtakes = outtakes; 
var enhanced = 0;
votes[movieID].enhanced = enhanced; 
var teaser = 0;
votes[movieID].teaser = teaser; 

//Movie #2
var movieID = 77777;
var stay = 'no';

votes[movieID]={};
votes[movieID].stay = stay;

var scenes = 0;
votes[movieID].scenes = scenes; 
var outtakes = 0;
votes[movieID].outtakes = outtakes; 
var enhanced = 0;
votes[movieID].enhanced = enhanced; 
var teaser = 0;
votes[movieID].teaser = teaser; 

//Alert Single Item from votes
alert(votes['55555'].stay);

//Alert entire object/array
alert(JSON.stringify(votes));//returns NULLs

//Alert entire object/array
//alert(votes.join('\n'));//returns lots of blanks


console.log(votes);



//Personal Notes Below

//votes[movieID].scenes = scenes;

//function insertVote(type, vote) {
//  votes[movieID][type] = vote;     
//}

//insertVote('scenes', scenes);

//alert(JSON.stringify(votes));




//var myObj = { 
//    'fred': { 'apples': 2, 'oranges': 4, 'bananas': 7, 'melons': 0 }, 
//    'mary': { 'apples': 0, 'oranges': 10, 'bananas': 0, 'melons': 0 }, 
//    'sarah': { 'apples': 0, 'oranges': 0, 'bananas': 0, 'melons': 5 } 
//}

//alert( myObj[ 'fred' ][ 'apples' ] );