# Cannot log a string with console.log?

**URL:** <https://meta.discourse.org/t/cannot-log-a-string-with-console-log/162960>\
**Category:** Development\
**Created:** [September 3, 2020, 7:41pm UTC](https://meta.discourse.org/t/cannot-log-a-string-with-console-log/162960 "2020-09-03T19:41:20Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [September 3, 2020, 7:41pm UTC](https://meta.discourse.org/t/cannot-log-a-string-with-console-log/162960/1 "2020-09-03T19:41:20Z")

</div>

I don’t see how this code isn’t doing what I expect. It seems to work over at w3schools.

### `head_tag.html`

```plaintext
<script type="text/discourse-plugin" version="0.8">

  const user = api.getCurrentUser();
  const { setDefaultHomepage } = require('discourse/lib/utilities');

  console.log("Primary group: " + user.primary_group_name);
  console.log('full map: ' + settings.group_homepage_map);
  if (settings.group_homepage_map && settings.group_homepage_map_enabled) {
      const map = settings.group_homepage_map.split("|");
      var two = map[1];
      console.log("Hello world!");
      console.log("hello? " + map);
      console.log("my map zero: " + map[0]);
      console.log(map[0]);
      console.log(map[1]);
      console.log(String('some text'));
      console.log("wwf: " + map[0]);
      console.log('two' + map[1] + 'one');
      console.log("first group: " + map[0].split(',')[0]);
      console.log("first url: " + map[0].split(',')[1]);
      console.log("second: " + map[1]);
      console.log("thing: ", map[0].split(",")[1]);
    }
  if (settings.home_url_override && settings.home_url_override_group.length == 0 ) {
    setDefaultHomepage(settings.home_url_override);
  }

</script>

```

All that’s showing up in the javascript console is this:

```plaintext
Primary group: lastone
full map: lastone,c/transcription/5|testergroup,latest
hello? lastone,c/transcription/5,testergroup,latest
my map zero: lastone,c/transcription/5
lastone,c/transcription/5
wwf: lastone,c/transcription/5
first group: lastone

```

So it appears that I cannot log just a string, and I can’t access item `[1]` of an array.

The gods must be crazy.

---

_[View the full topic](https://meta.discourse.org/t/cannot-log-a-string-with-console-log/162960)._
