Musterlösung Strings
Schreiben Sie ein kleines Skript, das mithilfe von str.splice () das Wort »Liebling« zurückgibt.
const text = "Saras Lieblingskleid ist rot";
-
Ersetzen Sie das Wort »Erscheinung« durch »Fata Morgana«.
const far = "Am Horizont sahen sie eine Erscheinung";
-
Setzen Sie den vollständigen Text in Großbuchstaben.
const game = "Lara Croft – Tomb Raider";
const text = "Saras Lieblingskleid ist rot"; const res = text.slice (6,14); console.log ("res", res) const far = "Am Horizont sahen sie eine Erscheinung"; const replaced = far.replace ("Erscheinung", "Fata Morgana"); console.log ("replaced", replaced); const game = "Lara Croft – Tomb Raider"; const vers = game.toUpperCase (); console.log ("vers", vers);