[code review]

Hi there,

I am new to closures and come from a class-ical background. I am slowly understanding the principles and I asked on this forum the best way to set some simple flags protected by closures so that they retained their values and could be set() and get().

I had a few responses but didn’t get what I wanted so I came up with this after reading a number of different tutorials:

		function Player(player,flowplayer,YouTube,chrome)
			Player.prototype.set_state = function(){
	                this.current_player = player;
			this.flowplayer_initiated = flowplayer;
			this.YouTube_initiated = YouTube;
			this.chrome = chrome;
			Player.prototype.get_state = function(state) {
			    return state;
		var player = new Player(); 

I like it because the syntax feels familiar but I am concerned about whether it is a wise way to go it and if this may create performance overheads, I have stepped though it and it doesn’t seem to do anything horrific but I’d like some input.

I would also appreciate any advice to help understand the many and often confusing different types of closures that are out there. I am very dedicated to Js and had some initial problems when first faced with the JQuery syntax ( mainly due to all the brackets and braces) but I soldiered on. I am keen to pick up as many tips as possible :slight_smile:

thanks kindly