Why are Map.entries(), forEach(), get(), set() methods not working?

Hi All,

I’m new to JS programming. Does anyone know why many Map methods don’t work and don’t throw any error? They just do nothing when running in Scriptable. I tested in Safari web inspector and everything is fine. Any advice would be appreciated.

Please post an example.

It looks like they all work just fine for me.

let mapObj = new Map();
mapObj.set(0, 'Automators');
mapObj.set(1, 'is a podcast on the');
mapObj.set(2, 'RelayFM network');
let iterator = mapObj.entries();
console.log(iterator.next().value);
console.log(iterator.next().value);
console.log(iterator.next().value);

console.log("---");

let arrInfo = ["Automatiors", "is", "a", "podcast"];
arrInfo.forEach(logit);

function logit(p_input)
{
  console.log(p_input); 
}

console.log("---");

let objPodcast =
{
	network : "RelayFM",
	podcast : "Adapt",
	
	get cast()
	{
		return this.podcast;
	},
	
	set cast(p_podcast)
	{
		this.podcast = p_podcast;
	}
		
};

console.log(objPodcast.cast);
objPodcast.cast = "Automators";
console.log(objPodcast.cast);

Given you see it working okay in Safari, any chance whatever it is you might be working on utilises browser only objects which Scriptable doesn’t have? e.g. anything using the document object model (DOM).

2 Likes