---
# System prepended metadata

title: NEAR-SDK-JS Best Practices

---

# NEAR-SDK-JS Best Practices 

## Writing Smart Contracts in Typescript 
While (clearly) you can write your smart contract in javascript we recommend that you use [typescript](https://www.executeprogram.com/courses/typescript-basics/articles/is-typescript-better-than-javascript) for your smart contract. As the name suggests it allows you to define the types for your variables and function outputs. Javascript utilizes what's called [dynamic typing](https://developer.mozilla.org/en-US/docs/Glossary/Dynamic_typing). Which means the interpreter assigns variables a type at runtime. This can lead to unexpected errors or outputs in your code. Unfortunately the type enforcement does not translate to the wasm file output but during the development stage it can help you avoid errors in the future. 


## Constructor vs No Constructor
Some examples within the near-sdk-js repo vary with the inclusion of a constructor in a given class. In typescript a constructor is not neccessary for use within in a class, whereas in javascript it is. However if you ever intend to extend a class within typescript you will need the constrctor. Hopefully this clears up some ambiguity if you see some class instances without a constructor and some with one. 

## Collections vs Native Data Structures 
While writ

