Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

JavaScript enum sample - how does this work? -


this bit of code this answer.

i'm trying understand how works i'm not getting all.

what think happening test_error closure errorvalue can't changed. 1 reference value this: test_error.success. please correct me if either of statements incorrect.

what don't understand return statement doing. it's returning object made of different errorvalues, returning what? , returning from? , when being called?

var test_error = (function() {   function errorvalue(value, friendly) {     this.value = value;     this.friendly = friendly;   }   errorvalue.prototype = {     tostring: function() { return this.friendly; },     valueof: function() { return this.value; }   };   return {     'success': new errorvalue(0, 'success'),     'fail': new errorvalue(1, 'fail'),     'id_error': new errorvalue(2, 'id error')   }; })();  

thanks!

paul

test_error closure errorvalue can't changed.

test_error end being object specified in return statement inside anonymous function. this object can changed.

one reference value this: test_error.success

that's correct.

what don't understand return statement doing. it's returning object made of different errorvalues, returning what? , returning from? , when being called?

the return statement returning anonymous function that's declared with

(function() { ...})();

the () @ end means anonymous function being called immediately after declared, , value inside return block assigned test_error

here's article on closures , emulating private variables might useful.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -