Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142218

How to slice a string in a nested element inside of an array with Javascript?

$
0
0

I need to slice a string element that is nested inside of a JSON file formatted as an array using JS.

"fields": {
            "title": "Jameson Library 12th Floor",
            "slug": "Jameson-12th-floor",
            "shortDescription": "[All Jameson Library Floors](/jameson-floor-maps \"All Jameson Library Floors\")",
            "building": {

The filteredFloors array is passed into the component as data and mapped to a table.

{data.map(item => (
          <tr key={item.sys.id}>
            {columns.map(column =>
              <td role='cell' key={this.createKey(item, column)}>{this.renderCell(item, column)}</td>)

I'm trying to return an array that omits the first 17 spaces of the title so all that remains is the floor (i.e. "12th Floor"). Any ideas?


Viewing all articles
Browse latest Browse all 142218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>