import { last } from "https://deno.land/x/prelude_js@1.2.0/last.ts";
Returns the last element of the given string.
Examples
Example 1
Example 1
import { last } from "https://deno.land/x/prelude_js@$VERSION/last.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(last(""), "");
assertEquals(last("abc"), "c");
Parameters
input: T
Any string.
Returns the last element of the given tuple.
Examples
Example 1
Example 1
import { last } from "https://deno.land/x/prelude_js@$VERSION/last.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(last([]), undefined);
assertEquals(last([1, 2, 3]), 3);
Parameters
input: readonly [...unknown[], T]
Any tuple.
Returns the last element of the given iterable.
Examples
Example 1
Example 1
import { last } from "https://deno.land/x/prelude_js@$VERSION/last.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(last(new Set(["x", "y", "z"])), "z");
Parameters
input: Iterable<T>
Any iterable.