class-test.js 291 B

123456789101112131415161718
  1. /**
  2. * Created by fy on 15-10-4.
  3. */
  4. 'use strict';
  5. let s = 'hello';
  6. function func(s) {
  7. if (s.includes('llo')) return 'pdf';
  8. else return 'img';
  9. }
  10. let xx = {
  11. name: 'hello',
  12. [/*s.includes("llo") ? 'pdf' : 'img'*/
  13. func(s)
  14. ]: (function () {
  15. return 1;
  16. })()
  17. };
  18. console.log(xx);