cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Javascript: Please explain notation: ({ bracket - curly bracket

0 Kudos

Hi all,

could anybody please explain the notation bracket followed by curly bracket.

When do we have to use it?

Example - in second line : new sap.m.Image({

         sap.ui.getCore().attachInit(function () {
         	 var oImage = new sap.m.Image({
             	src: "img/UI5_logo.png",
             	decorative: false,
             	alt: "SAPUI5 Logo"
             }).placeAt("content");

Thanks, regards

Mario

View Entire Topic
0 Kudos

Hi Mahesh,

many thanks. But the samples you provided all contain combinations like

(){}

But my question differs:

({})

I cannot find an explanation in the www.

Do you have an explanation?

thanks

Regards

Mario

maheshpalavalli
Active Contributor
0 Kudos

It means u are passing an JSON object to a class constructor when instantiating it. See the documentation below

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects

Or it can be that you are calling a function and passing object to it like Jun said

https://stackoverflow.com/questions/7764536/pass-object-to-javascript-function