Skip to content

complex_object.fn("print me!"); triggers an "Uncaught TypeError: Illegal invocation(…)" in the Chrome Console #11

Description

@jonathanhle

var complex_object = {
string: "I'm a string!",
number: 42,
//don't worry about this too much yet, just accept thats its a different data type
array: ["all sorts of stuff", 10, true, undefined, function(){console.log('beepity-beep')}],
//we haven't covered functions yet either, just accept that they too can be stored in objects
fn: console.log,
//Now THIS is interesting, an object INSIDE of an object!?
simple_object: {name: 'bob', location: 'basement', happy: 'false'},
};

complex_object.string;
complex_object.array;
complex_object.simple_object.name;
complex_object.fn("print me!");
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions