25 Jul

Dynamic/Static/Strong/Weak Types

A dynamically typed language is a language where the type of a variable can be altered at any time. (It is a string, now it is a Fixnum, now it is a Time object, etc.)

A statically typed language is the opposite. (Decide what x is once for all and don’t change your mind!)

A strongly typed language is a language that is being strict about what you can do with your typed variables. (Don’t mix them… or I will throw you an error in the face!)

A weakly typed language is the opposite. (Do what you want with your different types. Mix them all! We’ll see what happens!)

Original Article

[tags]type,types,duck,static,weak,strong,dynamic[/tags]

06 Mar

Object or Array

Find whether the given variable is an object,or is an Array?

function isArray(testObject) {	 
    return testObject && !(testObject.propertyIsEnumerable('length')) && typeof testObject === 'object' && typeof testObject.length === 'number';
}

Original Page
[tags]javascript,object,array,type[/tags]