Advertisement
Fhernd

app.js

Nov 9th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Producto = (function () {
  2.     var codigo = 1001;
  3.     var nombre = 'John Ortiz Ordoñez';
  4.     var precio = 50000;
  5.     var cantidad = 100;
  6.  
  7.     var getCodigo = function(){
  8.         return codigo;
  9.     };
  10.  
  11.     var getNombre = function(){
  12.         return nombre;
  13.     };
  14.  
  15.     var getPrecio = function(){
  16.         return precio;
  17.     };
  18.  
  19.     var getCantidad = function(){
  20.         return cantidad;
  21.     };
  22.  
  23.     return {
  24.         getCodigo: getCodigo,
  25.         getNombre: getNombre,
  26.         getPrecio: getPrecio,
  27.         getCantidad: getCantidad
  28.     };
  29. })();
  30.  
  31. console.log(Producto.getNombre());
  32. console.log(Producto.getCodigo());
  33. console.log(Producto.getPrecio());
  34. console.log(Producto.getCantidad());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement