Programming-Idioms

Implementation
JS

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another JS implementation.

Other implementations
import java.util.Map;
m.containsValue(v)
func containsValue(m map[K]T, v T) bool {
	for _, x := range m {
		if x == v {
			return true
		}
	}
	return false
}
print "Found it!" if exists $m{$v};
use std::collections::BTreeMap;
let does_contain = m.values()
        .any(|&val| *val == v);
import std.algorithm;
m.byValue.canFind(v);
m.containsValue(v);
v in m.values()
uses fgl;
m.IndexOfData(v) >= 0
m.value?(v)
Map.values(m) |> Enum.member?(v)
elem v (elems m)
in_array($v, $m, true);
!m.values.find(_ == v).isEmpty()
using System.Collections.Generic;
m.ContainsValue(v)
#include <algorithm>
std::find_if(m.begin(), m.end(), [v](const auto& mo) {return mo.second == v; }) != m.end();
[...m.values()].includes(v)