I just realized that the table titles in a FeatureLayer contain the service name as a prefix. This is reproducible in ArcGIS Enterprise 11.3 and currently in ArcGIS Online.
To be clear:
This gives me a list of "<LayerTitles>"...
webmap.allLayers.items.map(t => t.title)
...while this gives me a list of "<ServiceName> - <TableName>"
webmap.allTables.items.map(t => t.title)
Same goes for webmap.tables.
Is this a bug, @JuliePowell?
Here's a little sample to demonstrate the issue (open console): https://codepen.io/esride-Nik/pen/vENKeNj. This is what it looks like:
There's a code snippet in the docs at Map.allTables that indicates that should be different. The following comparison wouldn't work:
// A feature layer where isTable = true.
const foundTable = map.allTables.find(function(table) {
// Find a table with title "US Counties"
return table.title === "US Counties";
});