This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -25,6 +25,11 @@
|
||||
const outputElement = document.querySelector('.output');
|
||||
|
||||
const name = 'Heribert Gold '.trim();
|
||||
const firstName = name.substring(0, name.indexOf(' '));
|
||||
const lastName = name.substring(name.lastIndexOf(' ') + 1);
|
||||
|
||||
console.log(firstName); // => 'Heribert'
|
||||
console.log(lastName); // => 'Gold'
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user