Skip to content

Instantly share code, notes, and snippets.

@pandr
Last active October 22, 2015 06:30
Show Gist options
  • Save pandr/261d052f2deaee04a4af to your computer and use it in GitHub Desktop.
Save pandr/261d052f2deaee04a4af to your computer and use it in GitHub Desktop.
JavaScript Strenge
var fornavn = "Hans";
var efternavn = "Jensen";
var navn = fornavn + " " + efternavn; // "Hans Jensen"
var tom_streng = "";
var historie = "Der gik en hest";
var laengde = historie.length; // antal bogstaver i historien
var fundet = historie.indexOf("var");
var e = historie.charAt(1); // "e"
var ord = historie.substr(4,3); // "gik"
var alfabet = "abcdefghijklmnopqrstuvwxyz";
var b_code = alfabet.charCodeAt(0); // 98
var a = String.fromCharCode(97); // "a"
var tal = "1,2,3,4";
var tal_liste = tal.split(","); // ["1", "2", "3", "4"]
var abc = "abc".split(""); // ["a","b","c"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment