funcion dentro de objeto
JavaScript
//Calcular area rectangulo con objetos
//método
function rectangulo(base, altura) {
this.base = base;
this.altura = altura;
this.calcularArea = function () { return this.base * this.altura; };
}
//instanciamos el objeto rectángulo:
var r1 = new rectangulo(2, 4);
//y llamamos al método área:
console.log(r1.calcularArea());
Also in JavaScript:
- Title
- chrome add a javascript bookmark
- Category
- JavaScript
- Title
- async await anonymous function
- Category
- JavaScript
- Title
- how to apply gavity to code in javascript
- Category
- JavaScript
- Title
- create node project
- Category
- JavaScript
- Title
- How to pass a map from controller to javascript function in VF page
- Category
- JavaScript
- Title
- add class javascript
- Category
- JavaScript
- Title
- How to append to a file in Node?
- Category
- JavaScript
- Title
- append item to array javascript
- Category
- JavaScript
- Title
- git empty commit
- Category
- JavaScript
- Title
- get unique id angular
- Category
- JavaScript
- Title
- array vowels js
- Category
- JavaScript
- Title
- apache log format json
- Category
- JavaScript
- Title
- hashing in javascript
- Category
- JavaScript
- Title
- angular material table
- Category
- JavaScript
- Title
- convert object to json javascript
- Category
- JavaScript
- Title
- disable input angular
- Category
- JavaScript
- Title
- event handler attachment jquery
- Category
- JavaScript
- Title
- how to add validator to formgroup
- Category
- JavaScript
- Title
- append to array js
- Category
- JavaScript
- Title
- how to parse query string in node.js lambda
- Category
- JavaScript
- Title
- how to english paragraph matching in javascript
- Category
- JavaScript
- Title
- angular routing url params
- Category
- JavaScript
- Title
- how to get the index of an array in javascript
- Category
- JavaScript
- Title
- close bootstrap modal with javascript
- Category
- JavaScript
- Title
- get timer start adding the started at time js
- Category
- JavaScript
- Title
- adding element to array javascript
- Category
- JavaScript
- Title
- Vue.js force to reload re-render
- Category
- JavaScript
- Title
- chrome extension get current tab from popup
- Category
- JavaScript
- Title
- get attribute value jquery
- Category
- JavaScript
- Title
- add and remove class in jquery
- Category
- JavaScript
- Title
- async await javascript
- Category
- JavaScript
- Title
- how to get a random element of an array javascript
- Category
- JavaScript
- Title
- default pool size in sequelize
- Category
- JavaScript
- Title
- gitignore for angular
- Category
- JavaScript
- Title
- datatable on error.dt
- Category
- JavaScript
- Title
- how to use local static images in svelte
- Category
- JavaScript
- Title
- ellipsis javascript
- Category
- JavaScript
- Title
- foreach over array javascript
- Category
- JavaScript
- Title
- hoisting in javascript
- Category
- JavaScript
- Title
- client side redirect javascript
- Category
- JavaScript
- Title
- go to another page using javascript
- Category
- JavaScript
- Title
- google sign in in firebase react
- Category
- JavaScript
- Title
- how to add array numbers in javascript
- Category
- JavaScript
- Title
- add char in specific index stirng javascript
- Category
- JavaScript
- Title
- angular transition animation
- Category
- JavaScript
- Title
- fetch composition API in Vue3
- Category
- JavaScript
- Title
- global site tag (gtag.js) - google analytics gatsby
- Category
- JavaScript
- Title
- how to create a variable in javascript
- Category
- JavaScript
- Title
- convert string to char array javascript
- Category
- JavaScript
- Title
- href before onclick js
- Category
- JavaScript
- Title
- check array values equal js
- Category
- JavaScript
- Title
- call js
- Category
- JavaScript
- Title
- adding a variable to a string without using + in javascript
- Category
- JavaScript
- Title
- include jquerty
- Category
- JavaScript
- Title
- document ready
- Category
- JavaScript
- Title
- create an element jquery
- Category
- JavaScript
- Title
- google auth.onstatechange
- Category
- JavaScript
- Title
- fix your timestep javascript
- Category
- JavaScript
- Title
- .includes javascript
- Category
- JavaScript
- Title
- how to remove session data on tab close in redux\
- Category
- JavaScript
- Title
- how to convert audio blocb to base64 string
- Category
- JavaScript
- Title
- bind in javascript
- Category
- JavaScript
- Title
- how to add up all numbers in an array
- Category
- JavaScript
- Title
- convert string true to boolean true javascript
- Category
- JavaScript
- Title
- clear terminal node js
- Category
- JavaScript
- Title
- how to filter object in javascript
- Category
- JavaScript
- Title
- codemirror get object from textarea
- Category
- JavaScript
- Title
- input set variable angular
- Category
- JavaScript
- Title
- creating js objects
- Category
- JavaScript
- Title
- chai js
- Category
- JavaScript
- Title
- get a element using name in jquery
- Category
- JavaScript
- Title
- how to generate random string in javascript
- Category
- JavaScript
- Title
- clear scene\
- Category
- JavaScript
- Title
- bq show pretty json
- Category
- JavaScript
- Title
- expo open app settings
- Category
- JavaScript
- Title
- how to convert time to am pm in javascript
- Category
- JavaScript
- Title
- filtering json array in javascript
- Category
- JavaScript
- Title
- difference between React Native and React
- Category
- JavaScript
- Title
- how to return a string x amount in javascript without using . repeat
- Category
- JavaScript
- Title
- deparam javascript
- Category
- JavaScript
- Title
- bootstrap 4 open tab when opening modal
- Category
- JavaScript
- Title
- how to compare strings javascript
- Category
- JavaScript
- Title
- add elements to an array with splice
- Category
- JavaScript
- Title
- get last element of array javascript
- Category
- JavaScript
- Title
- angular calendar updating until hovering
- Category
- JavaScript
- Title
- how to add up all the numbers in between 0 and that number
- Category
- JavaScript
- Title
- Javascript compare two objects
- Category
- JavaScript
- Title
- event target javascript
- Category
- JavaScript
- Title
- how to ask input in javascript
- Category
- JavaScript
- Title
- add item to array javascript
- Category
- JavaScript
- Title
- how to validate the radio button using jquery
- Category
- JavaScript
- Title
- dynamic for loop react
- Category
- JavaScript
- Title
- how to make a calculator websiteJS
- Category
- JavaScript
- Title
- async await catch error
- Category
- JavaScript
- Title
- generate new component angular
- Category
- JavaScript
- Title
- javacript count properties
- Category
- JavaScript
- Title
- how to use the foreach method in javascript
- Category
- JavaScript
- Title
- electron scrollbar
- Category
- JavaScript
- Title
- eyeshot javascript version
- Category
- JavaScript
- Title
- event.persist()
- Category
- JavaScript