how to return an object in javascript
person = {
'name':'john smith'
'age':41
};
console.log(person);
//this will return [object Object]
//use
console.log(JSON.stringify(person));
//insteadfunction func() {
return {
name: "Name",
age: 34
};
}var mycar = new Car('Eagle', 'Talon TSi', 1993);
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
Also in JavaScript:
- Did you mean to use React.forwardRef()?
- chrome extension inject html
- react router last page
- sending value in input angular material
- make a if in jsx
- website login and registartion source code jsp java
- swagger.json multiple file upload
- promises and not callbacks
- delete from array based on value javascript
- require jquery tampermonkey
- get year javascript copyright
- object to json c#
- post jquery
- js add event listener
- how to start react project on atom
- regular expression for email and mobile
- angular convert boolean to yes no
- react native updating options with setoptions
- round to decimal javascript
- is game development with javscript wrth it ?
- functional component react
- jqgrid beforeShowForm
- how to swap two images in javascript
- javascript class constructor