Map nested array with JavaScript

Map nested array with JavaScript

I'm trying to map a nested array using .map(), so I could display and pinpoint all London underground locations in a map.

I'm trying to map a nested array using .map(), so I could display and pinpoint all London underground locations in a map.

this.undergroundGeoJson = [
        {
            'type': 'FeatureCollection',

        'crs': { 'type': 'name', 'properties': { 'name': 
        'urn:ogc:def:crs:OGC:1.3:CRS84' } },

        'features': [
            {
                'type': 'Feature',
                'geometry': {
                    'type': 'Point',
                    'coordinates': [-0.278126, 51.5025]
                },
                'properties': {
                    'name': 'Acton Town'
                }
            },
            {
                'type': 'Feature',
                'geometry': {
                    'type': 'Point',
                    'coordinates': [-0.263033174, 51.50883531]
                },
                'properties': {
                    'name': 'Acton Central'
                }
            },
            {
                'type': 'Feature',
                'geometry': {
                    'type': 'Point',
                    'coordinates': [-0.262879534, 51.50856013]
                },
                'properties': {
                    'name': 'Acton Central'
                }
            }
       }
   ]

I need the coordinates array elements down in the geometry obj.

this is my code so far...

@computed
    get undergroundLatLongs() {
    return this.undergroundGeoJson.map((u) =>
    [u.features.geometry.coordinates[0], 
    u.features.geometry.coordinates[1]]);
}

and this is the error log...

Uncaught TypeError: Cannot read property 'coordinates' of undefined

any help welcomed.

javascript arrays reactjs

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Increase Performance of React Applications Via Array JavaScript Methods

Increase Performance of React Applications Via Array JavaScript Methods. We will create a simple event management application in the react to add, update, and delete an event.

Javascript Array From Example | Array.prototype.from()

Javascript array from() is an inbuilt function that creates a new, shallow-copied array instance from an array-like object or iterable object.

A quick guide to JavaScript Arrays

6 most commonly used methods and how they’re implemented. Arrays are a structure common to all programming languages so knowing what they are and having a firm grasp on what you’re able to accomplish with Arrays will take you a long way in your journey as a software developer.

Javascript Array Shift Example | Array.prototype.shift()

Javascript array shift() is an inbuilt function that removes the first item from an array and returns that deleted item. It changes the length of the array.

Javascript Array Keys Example | Array Keys In Javascript

Javascript Array keys() method returns the new array Iterator object that contains the keys for each index in an array. avascript Array Keys Example.