Last active
December 7, 2019 20:51
-
-
Save muratbaseren/719f9c57d4c76c45049817f07f5f691a to your computer and use it in GitHub Desktop.
ES6 Modül Kullanımı
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Math.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// export ile 2 adet metodu dışarıya açıyoruz. | |
export const topla = (x, y) => x + y; | |
export const cikar = (x, y) => x - y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// math.js dosyasını uzantısı ile import ediyoruz. | |
// uzantının yazılması önemliymiş.. | |
// içerisindeki metotlara erişmeyi sağlıyoruz. | |
import { topla, cikar } from './math.js'; | |
console.log(topla(1, 3)); | |
console.log(cikar(5, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<!-- type ifadesi önemliymiş yoksa kodlar çalışmıyor. --> | |
<!-- yazılan modlüllerin sayfaya eklenmesi --> | |
<script type="module" src="es6sample.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment