Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

destructuring interfaces in the most simple way <>

function printLabel(labelledObj: { label: string }) {
    console.log(labelledObj.label);
}

let myObj = {size: 10, label: "Size 10 Object"};
printLabel(myObj);
Source by makecode.microbit.org #
 
PREVIOUS NEXT
Tagged: #destructuring #interfaces #simple
ADD COMMENT
Topic
Name
5+4 =