Skip to content

JavaScript Objects

Marie-Louise edited this page Sep 26, 2018 · 8 revisions

JavaScript is made up of two different types of objects. Numbers are one type of object Strings are the other type of object

The Math Object

the properties are numbers that are used in certain calculations

the methods are mathematical functions that javascript is programmed to form.

objects have methods they can perform and properties

Objects are similar to variables, but instead they can contain many values. Each value is written as a pair separated by a semicolon i.e name:value . These pairs are referred to as properties .

var car = {type:"Fiat", model:"500", color:"white"};

In the Drupal codebase (footer.tpl.config.js) it's necessary to edit the following object :

module.exports = {
  name: 'Footer',
  status: 'ready',
  preview: '@preview_fullwidth.tpl',
  context: {
    back_to_top: '',
    search: '',
    navigation: '',
    social: [
      {
        url: 'https://twitter.com/wellcometrust',
        title: 'Twitter',
        class_modifier: 'twitter'
      },
      {
        url: 'https://www.facebook.com/WellcomeTrust/',
        title: 'Facebook',
        class_modifier: 'facebook'
      },
      {
        url: 'https://www.youtube.com/user/wellcometrust',
        title: 'YouTube',
        class_modifier: 'youtube'
       },
      {
        url: 'https://www.linkedin.com/company/wellcome-trust',
        title: 'LinkedIn',
        class_modifier: 'linkedin'
      }
    ],
    footer_navigation: [
      {
        title: 'Footer item',
        url: '/',
      },
      {
        title: 'External site',
        url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
      },
      {
        title: 'More navigation',
    url: '/',
      },
      {
        title: 'A slightly longer nav item',
        url: '/',
      }
    ]
  }
};

Clone this wiki locally